public function act_coe_list() { $this->related_events = Browse::getChainOfEvents($this->event->event_record_number); $this->related_events_reverse = Browse::getChainOfEventsReverse($this->event->event_record_number); if (isset($_GET['coe_id'])) { global $messages; $coe = new ChainOfEvents(); $coe->LoadFromRecordNumber($_GET['coe_id']); if ($_GET['reverse']) { $coe->reverse(); } $coe->LoadRelationships(); if ($coe->chain_of_events_record_number != $_GET['coe_id'] || $coe->chain_of_events_record_number == '') { shnMessageQueue::addError($messages['coe_not_found']); unset($_GET['type']); } else { $this->coe = $coe; } } switch ($_GET['type']) { case 'coe': $this->related_event = new Event(); $this->related_event->LoadFromRecordNumber($coe->related_event); $this->related_event->LoadRelationships(); break; } }
public function act_import() { global $conf; global $global; global $errors; //if a file is uploadded process that file if (is_uploaded_file($_FILES['xml']['tmp_name'])) { //move upload file to a temporary location $error = (include_once 'import_xml.inc'); if ($error) { return; } $global['errorindex']; $global['export_instance']; $global['export_date']; $global['$export_time']; $global['errorindex'] = new ImportLog(); $this->index_terms = $global['errorindex']->Find(''); if (count($errors) > 0) { $string; shnMessageQueue::addError(_t('SOME_ERRORS_OCCURED_WHILE_IMPORTING_DATA_')); mkdir($conf["media_dir"] . "Import_Error_log", 0755); $filename = 'error_report_' . date('Ymd-His') . '.txt'; $file_path = $conf['media_dir'] . "/Import_Error_log/" . $filename; $filehandler = fopen($file_path, 'w') or die("Can't open the file"); foreach ($errors as $error) { $data = "{$error['key']} {$error['msg']}\n"; fwrite($filehandler, $data); } $_SESSION['report_filename'] = $filename; $_SESSION['file_path'] = $file_path; $global['errorindex']->file_name = $filename; $global['errorindex']->file_path = $file_path; $global['errorindex']->date = date("Y/m/d"); $global['errorindex']->time = date("H:i:s"); $global['errorindex']->status = "Error"; $global['errorindex']->export_instance = $global['export_instance']; $global['errorindex']->export_date = $global['export_date']; $global['errorindex']->export_time = $global['$export_time']; $global['errorindex']->Save(); fclose($filehandler); $this->errors = $errors; } else { $global['errorindex']->date = date("Y/m/d"); $global['errorindex']->time = date("H:i:s"); $global['errorindex']->status = "Successful"; $global['errorindex']->export_instance = $global['export_instance']; $global['errorindex']->export_date = $global['export_date']; $global['errorindex']->export_time = $global['$export_time']; $global['errorindex']->Save(); shnMessageQueue::addInformation(_t('OPENEVSYS_HAS_SUCCESSFULLY_IMPORTED_THE_DATA_')); } } else { if (isset($_POST['upload'])) { shnMessageQueue::addError(_t("PLEASE_UPLOAD_A_VALID_OPENEVSYS_XML_FILE_")); } } if ($_GET['message'] == 'error') { $filename = $_SESSION['report_filename']; $file_path = $_SESSION['file_path']; $size = filesize($file_path); header("Content-Type: text/plane"); header("Content-Disposition: attachment; filename=" . $filename); header("Content-Length: " . $size); $fp = fopen($file_path, 'rb'); fpassthru($fp); exit; } }
public function act_permissions() { $gacl_api = acl_get_gacl_api(); $this->roles = acl_get_roles(); if (isset($_POST['update'])) { foreach ($this->roles as $role_val => $role_name) { if ($role_val == 'admin') { continue; } $acl_id = $gacl_api->search_acl('access', 'access', FALSE, FALSE, $role_name, 'person', $this->person->person_record_number, FALSE, FALSE); if (isset($_POST['roles']) && in_array($role_val, $_POST['roles'])) { if (count($acl_id) == 0) { $aro_grp = $gacl_api->get_group_id($role_val, $role_name, 'ARO'); $return = $gacl_api->add_acl(array('access' => array('access')), null, array($aro_grp), array('person' => array($this->person->person_record_number)), null, 1); } } else { $gacl_api->del_acl($acl_id[0]); } } set_redirect_header('person', 'permissions'); } if (isset($_POST['add_user']) && $_POST['add_user'] != '') { $username = $_POST['add_user']; if (UserHelper::isUser($username)) { $return = $gacl_api->add_acl(array('access' => array('access')), array("users" => array($username)), null, array('person' => array($this->person->person_record_number)), null, 1); } else { shnMessageQueue::addError(_t('USERID_DOES_NOT_EXISTS_')); } } if (isset($_POST['remove_user'])) { $acl_id = $gacl_api->search_acl('access', 'access', 'users', $_POST['remove_user'], FALSE, 'person', $this->person->person_record_number, FALSE, FALSE); if (isset($acl_id[0])) { $gacl_api->del_acl($acl_id[0]); } } //populate checkboxes $this->value = array(); foreach ($this->roles as $role_val => $role_name) { $acl_id = $gacl_api->search_acl('access', 'access', FALSE, FALSE, $role_name, 'person', $this->person->person_record_number, FALSE, FALSE); if (count($acl_id) > 0) { $this->value[$role_val] = $role_val; } } //get users with permissions $this->users = acl_get_allowed_users($this->person->person_record_number, $type = 'person'); }