function validate_submission in GlobalLink Connect for Drupal 7.7
1 call to validate_submission()
File
- ./
globallink_workbench_all_active_submissions.inc, line 945
Code
function validate_submission($attr, $attr_val) {
$output = array();
if ($attr == 'nid') {
$query = db_select('globallink_core', 'gc');
$query
->addField('gc', 'source', 'sourceLocale');
$query
->addField('gc', 'target', 'targetLocale');
$query = $query
->fields('gc', array(
'nid',
'vid',
'status',
'submission',
))
->condition('nid', $attr_val, '=');
$result = $query
->execute()
->fetchAll();
if (count($result) > 0) {
foreach ($result as $val) {
if ($val->submission == arg(4) && $val->targetLocale == arg(5)) {
$output[] = "node";
$output[] = $val;
}
}
}
else {
$query = db_select('globallink_core_entity', 'gce');
$query
->addField('gce', 'source', 'sourceLocale');
$query
->addField('gce', 'target', 'targetLocale');
$query = $query
->fields('gce', array(
'nid',
'vid',
'status',
'submission',
))
->condition('nid', $attr_val, '=');
$result = $query
->execute()
->fetchAll();
if (count($result) > 0) {
foreach ($result as $val) {
if ($val->submission == arg(4) && $val->targetLocale == arg(5)) {
$output[] = "entity";
$output[] = $val;
}
}
}
}
}
else {
if ($attr == 'bid') {
$query = db_select('globallink_core_block', 'gcb');
$query
->addField('gcb', 'source', 'sourceLocale');
$query
->addField('gcb', 'target', 'targetLocale');
$query
->addField('gcb', 'submission', 'submissionName');
$query
->addField('gcb', 'document_ticket', 'documentTicket');
$query = $query
->fields('gcb', array(
'status',
))
->condition('object_id', $attr_val, '=');
$result = $query
->execute()
->fetchAll();
if (count($result) > 0) {
foreach ($result as $val) {
if ($val->submissionName == arg(4) && $val->targetLocale == arg(5)) {
$output[] = "block";
$output[] = $val;
}
}
}
else {
$query = db_select('globallink_core_taxonomy', 'gct');
$query
->addField('gct', 'source', 'sourceLocale');
$query
->addField('gct', 'target', 'targetLocale');
$query
->addField('gct', 'submission', 'submissionName');
$query
->addField('gct', 'document_ticket', 'documentTicket');
$query = $query
->fields('gct', array(
'status',
))
->condition('object_id', $attr_val, '=');
$result = $query
->execute()
->fetchAll();
if (count($result) > 0) {
foreach ($result as $val) {
if ($val->submissionName == arg(4) && $val->targetLocale == arg(5)) {
$output[] = "taxonomy";
$output[] = $val;
}
}
}
}
}
else {
if ($attr == 'fpid') {
$query = db_select('globallink_core_fieldable_panels', 'gcfp');
$query
->addField('gcfp', 'source', 'sourceLocale');
$query
->addField('gcfp', 'target', 'targetLocale');
$query
->addField('gcfp', 'submission', 'submissionName');
$query
->addField('gcfp', 'document_ticket', 'documentTicket');
$query = $query
->fields('gcfp', array(
'status',
))
->condition('fpid', $attr_val, '=');
$result = $query
->execute()
->fetchAll();
if (count($result) > 0) {
foreach ($result as $val) {
if ($val->submissionName == arg(4) && $val->targetLocale == arg(5)) {
$output[] = "fieldable_panels";
$output[] = $val;
}
}
}
}
else {
if ($attr == 'lid') {
$query = db_select('globallink_core_interface', 'gci');
$query
->addField('gci', 'source', 'sourceLocale');
$query
->addField('gci', 'target', 'targetLocale');
$query
->addField('gci', 'submission', 'submissionName');
$query
->addField('gci', 'document_ticket', 'documentTicket');
$query = $query
->fields('gci', array(
'status',
))
->condition('object_id', $attr_val, '=');
$result = $query
->execute()
->fetchAll();
if (count($result) > 0) {
foreach ($result as $val) {
if ($val->submissionName == arg(4) && $val->targetLocale == arg(5)) {
$output[] = "interface";
$output[] = $val;
}
}
}
}
else {
if ($attr == 'mlid') {
$query = db_select('globallink_core_menu', 'gcm');
$query
->addField('gcm', 'source', 'sourceLocale');
$query
->addField('gcm', 'target', 'targetLocale');
$query
->addField('gcm', 'submission', 'submissionName');
$query
->addField('gcm', 'document_ticket', 'documentTicket');
$query = $query
->fields('gcm', array(
'status',
))
->condition('object_id', $attr_val, '=');
$result = $query
->execute()
->fetchAll();
if (count($result) > 0) {
foreach ($result as $val) {
if ($val->submissionName == arg(4) && $val->targetLocale == arg(5)) {
$output[] = "menu";
$output[] = $val;
}
}
}
}
else {
if ($attr == 'pid') {
$query = db_select('globallink_core_webform', 'gcw');
$query
->addField('gcw', 'source', 'sourceLocale');
$query
->addField('gcw', 'target', 'targetLocale');
$query
->addField('gcw', 'submission', 'submissionName');
$query
->addField('gcw', 'document_ticket', 'documentTicket');
$query = $query
->fields('gcw', array(
'status',
))
->condition('parent_id', $attr_val, '=');
$result = $query
->execute()
->fetchAll();
if (count($result) > 0) {
foreach ($result as $val) {
if ($val->submissionName == arg(4) && $val->targetLocale == arg(5)) {
$output[] = "webform";
$output[] = $val;
}
}
}
}
}
}
}
}
}
return $output;
}