foreach ($ArAttached as $IDAttach) { if (!F1DeskUtils::isAttached($IDTicket, $IDAttach)) { $ObjTicket->attachTicket($IDTicket, $IDAttach); } } } } elseif (!empty($_POST) && $_POST['StAction'] == 'addSupporters') { $ArSupporters = F1DeskUtils::getAllSupporters(); if ($ArSupporters[0]['IDSupporter'] == 0) { array_shift($ArSupporters); } } /*************************************** * Create Data * ****************************************/ if (F1DeskUtils::isSupporter()) { $BoCreate = F1DeskUtils::getPermission('BoCreateTicket', getSessionProp('IDSupporter')); if ($BoCreate) { $ArDepartments = F1DeskUtils::getPublicDepartments(false); } else { $ArDepartments = F1DeskUtils::getDepartmentsFormatted(getSessionProp('IDSupporter')); } } else { $ArDepartments = F1DeskUtils::getPublicDepartments(); } $ArTypes = F1DeskUtils::listTicketTypes(); $ArPriorities = F1DeskUtils::listPriorities(); $ArCategories = F1DeskUtils::listCategories(); if (F1DeskUtils::IsSupporter()) { $ArSub = F1DeskUtils::getSubDepartments(getSessionProp('IDSupporter')); }
public static function getDepartmentsFormatted($IDSupporter) { $ArFormatted = array(); $ArDepartments = F1DeskUtils::getDepartments($IDSupporter); $ArSubDepartments = F1DeskUtils::getSubDepartments($IDSupporter); foreach ($ArDepartments as $IDDepartment => $StDepartment) { if (array_key_exists($IDDepartment, $ArSubDepartments) === true) { $ArSubs = $ArSubDepartments[$IDDepartment]; } else { $ArSubs = array(); } $ArFormatted[$IDDepartment] = array('ID' => $IDDepartment, 'StDepartment' => $StDepartment, 'ArSubDepartments' => $ArSubs); } foreach ($ArSubDepartments as $IDDepartment => $ArSubDepartments) { foreach ($ArSubDepartments as $IDSubDepartments) { if (array_key_exists($IDSubDepartments, $ArDepartments) === true) { $ArFormatted[$IDSubDepartments] = array('ID' => $IDSubDepartments, 'StDepartment' => $ArDepartments[$IDDepartment] . '::' . $ArDepartments[$IDSubDepartments]); } } } return $ArFormatted; }