protected function action()
 {
     if (!parent::action()) {
         return false;
     }
     $action = 'RetrieveValueSet';
     if (count($this->request_remainder) > 0) {
         reset($this->request_remainder);
         $action = current($this->request_remainder);
     }
     $task = 'SVS_allow_' . $action;
     if (I2CE_PermissionParser::taskExists($task) && !$this->hasPermission('task(' . $task . ')')) {
         I2CE::raiseError("No permission");
         return false;
     }
     if ($action == 'config') {
         return $this->action_config();
     } else {
         if ($this->isGet()) {
             return $this->action_get($action);
         } else {
             return $this->action_post();
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Perform the main actions of the page.
  */
 protected function action()
 {
     $factory = I2CE_FormFactory::instance();
     $this->template->setAttribute("class", "active", "menuConfigure", "a[@href='configure']");
     $this->template->appendFileById("menu_configure.html", "ul", "menuConfigure");
     parent::action();
 }
 /**
  * Perform the main actions of the page.
  * @return boolean
  */
 protected function action()
 {
     if (!parent::action()) {
         return false;
     }
     if (!$this->hasPermission("task(person_can_edit_child_form_person_instance)")) {
         $this->userMessage("You do not have permission to edit participants for this instance.");
         return false;
     }
     if (!$this->get_exists('person') || !$this->get_exists('instance')) {
         $this->template->addFile('action_participants_error.html');
         return true;
     }
     $person_instance = $this->getPersonInstance($this->get('person'), $this->get('instance'));
     $piObj = I2CE_FormFactory::instance()->createContainer("person_instance|" . $person_instance);
     if ($person_instance) {
         $piObj->populate();
         if ($piObj->attending == 0) {
             $piObj->attending = 1;
             $this->template->addFile("action_participants_add.html");
         } else {
             $piObj->attending = 0;
             $this->template->addFile("action_participants_remove.html");
         }
     } else {
         $piObj->setParent($this->get('person'));
         $piObj->getField('provider_instance')->setFromDB($this->get('instance'));
         $piObj->getField('attending')->setFromDB(1);
         $this->template->addFile("action_participants_add.html");
     }
     return $piObj->save($this->user);
 }
 /**
  * Perform any actions for the page
  * 
  * @returns boolean.  true on sucess
  */
 public function action()
 {
     parent::action();
     if (count($this->request_remainder) == 0) {
         $msg = "You need to specify a report view";
         $this->userMessage($msg);
         I2CE::raiseError($msg);
         return false;
     }
     reset($this->request_remainder);
     $view = current($this->request_remainder);
     if (!$this->canViewReport($view)) {
         $msg = "You do not have permission to  view this reportview ({$view})";
         $this->userMessage($msg);
         I2CE::raiseError($msg);
         $this->setRedirect('noaccess');
         return false;
     }
     if ($this->page === 'saveOptions' && $this->hasPermission('task(custom_reports_can_edit_reportViews)')) {
         if (!$this->actionSaveOptions($view)) {
             $this->userMessage('Could not save display options', 'notice', false);
             //message is not delayed as we are showing below
         } else {
             $this->userMessage('Saved display options', 'notice', false);
             //message is not delayed as we are showing below
         }
     }
     return $this->actionShow($view);
 }
 public function action()
 {
     parent::action();
     $init_options = array('root_path' => '/modules/forms/storage_options/CSD/remote_services', 'root_path_create' => true, 'root_url' => 'remote_directory_selector', 'root_type' => 'ServiceDirectorySelector');
     try {
         $swiss_factory = new I2CE_SwissMagicFactory($this, $init_options);
     } catch (Exception $e) {
         I2CE::raiseError("Could not create swissmagic for selectable" . $e->getMessage());
         return false;
     }
     try {
         $swiss_factory->setRootSwiss();
     } catch (Exception $e) {
         I2CE::raiseError("Could not create root swissmagic for selectable" . $e->getMessage());
         return false;
     }
     $swiss_path = $this->request_remainder;
     $action = array_shift($swiss_path);
     if ($action == 'update' && $this->isPost()) {
         if ($swiss_factory->updateValues($this->post())) {
             $this->userMessage("Updated Remote Directories");
         } else {
             $this->userMessage("Unable To Update Remote Directories");
         }
         $this->setRedirect('home');
     }
     $action = 'edit';
     return $swiss_factory->displayValues($this->template->getElementById('siteContent'), $swiss_path, $action);
 }
Ejemplo n.º 6
0
 /**
  * Perform the main actions of the page.
  */
 protected function action()
 {
     parent::action();
     $this->template->setAttribute("class", "active", "menuPassword", "a[@href='password']");
     if ($this->isPost()) {
         $access = I2CE::getUserAccess();
         if (!$access instanceof I2CE_UserAccess_Mechanism || !$access->canChangePassword() || $this->user->getRole() == 'guest') {
             $success = 'no_change';
         } else {
             if (!$this->post('old_password') || !$this->post('new_password')) {
                 $success = 'none';
             } else {
                 if ($this->post('new_password') != $this->post('confirm_password')) {
                     $success = 'no_match';
                 } else {
                     if (!$this->user->changePassword($this->post('old_password'), $this->post('new_password'))) {
                         $success = 'wrong';
                     } else {
                         $success = 'success';
                     }
                 }
             }
         }
         //$this->template->addTextNode( "message", $message );
         if ($success == 'success') {
             $this->template->addFile("password_success.html");
         } else {
             $this->template->addFile("password_form.html");
             $this->template->addFile("password_" . $success . ".html", "td");
         }
     } else {
         $this->template->addFile("password_form.html");
     }
 }
 /**
  * Perform the main actions of the page.
  */
 protected function action()
 {
     parent::action();
     $person_id = 0;
     if ($this->get_exists('parent')) {
         $person_id = $this->get('parent');
     }
     $factory = I2CE_FormFactory::instance();
     $personForm = $factory->createContainer($person_id);
     if (!$personForm instanceof I2CE_Form) {
         return;
     }
     $personForm->populate();
     $this->setForm($personForm);
     $this->setDisplayData('person_id', 'id=' . $person_id);
     if ($this->get_exists('id')) {
         $competency_ids = array($this->get('id'));
     } else {
         $competency_ids = $personForm->getChildIds('person_competency');
     }
     $compAppendNode = $this->template->getElementById('comp_list');
     if (!$compAppendNode instanceof DOMNode) {
         return;
     }
     foreach ($competency_ids as $competency_id) {
         $compNode = $this->template->appendFileByNode("personal_competency_evaluation_history_comp_each.html", 'div', $compAppendNode);
         $compForm = $factory->createContainer('person_competency' . '|' . $competency_id);
         if (!$compForm instanceof I2CE_Form) {
             continue;
         }
         $compForm->populate();
         $this->setForm($compForm, $compNode);
         $competency = $factory->createContainer($compForm->getField("competency")->getDBValue());
         $competency->populate();
         $this->setForm($competency, $compNode);
         $appendNode = $this->template->getElementById('evaluation_list', $compNode);
         if (!$appendNode instanceof DOMNode) {
             return;
         }
         $fields = array('evaluation_date', 'competency_evaluation');
         $compForm->populateHistory($fields);
         $all_dates = array();
         foreach ($fields as $field) {
             while ($compForm->getField($field)->hasNextHistory()) {
                 $entry = $compForm->getField($field)->nextHistory();
                 $all_dates[$entry->date->dbFormat()][$field] = $entry;
             }
         }
         foreach ($all_dates as $entries) {
             $evalNode = $this->template->appendFileByNode("personal_competency_evaluation_history_each.html", 'tr', $appendNode);
             if (!$evalNode instanceof DOMNode) {
                 return;
             }
             foreach ($entries as $field => $entry) {
                 $this->template->setDisplayDataImmediate($field, $compForm->getField($field)->getDisplayValue($entry), $evalNode);
             }
         }
     }
 }
 /**
  * Perform any actions for the page
  * 
  * @returns boolean.  true on sucess
  */
 public function action()
 {
     parent::action();
     if (!$this->hasPermission('task(form_relationship_can_import)')) {
         return false;
     }
     return true;
 }
Ejemplo n.º 9
0
 public function action()
 {
     parent::action();
     // Add js file for displaying printf arguments
     $this->template->addHeaderLink('printf.js');
     $init_options = array('root_path' => '/I2CE/page', 'root_url' => 'PageBuilder', 'root_type' => 'PageBuilder');
     try {
         $swiss_factory = new I2CE_SwissMagicFactory($this, $init_options);
     } catch (Exception $e) {
         I2CE::raiseError("Could not create swissmagic for selectable" . $e->getMessage());
         return false;
     }
     try {
         $swiss_factory->setRootSwiss();
     } catch (Exception $e) {
         I2CE::raiseError("Could not create root swissmagic for selectable" . $e->getMessage());
         return false;
     }
     //grab the action from the request
     $action = array_shift($this->request_remainder);
     $swiss_path = $this->request_remainder;
     if ($action == 'update' && $this->isPost()) {
         if ($this->get('noRedirect')) {
             $redirect = false;
         } else {
             $redirect = true;
         }
         $msgs = array('not_updated' => 'Unable to Update Values', 'updated' => 'Updated Values');
         foreach ($msgs as $k => &$v) {
             I2CE::getConfig()->setIfIsSet($v, "/I2CE/page/text/user_messages/{$k}");
         }
         I2CE::raiseError(print_r($this->post(), true));
         if ($swiss_factory->updateValues($this->post(), $redirect)) {
             $msg = $msgs['updated'];
         } else {
             $msg = $msgs['not_updated'];
         }
         if ($redirect) {
             $this->userMessage($msg, 'notice', true);
             $swiss = $swiss_factory->getSwiss($swiss_path);
             if ($swiss instanceof I2CE_Swiss) {
                 $redirect = $swiss->getURLRoot('edit') . $swiss->getPath() . $swiss->getURLQueryString();
             } else {
                 $redirect = 'PageBuilder';
             }
             $this->setRedirect($redirect);
             return true;
         }
     } else {
         if ($action == 'delete') {
             return $this->actionDelete($init_options['root_path']);
         }
     }
     $action = 'edit';
     return $swiss_factory->displayValues($this->template->getElementById('siteContent'), $swiss_path, $action);
 }
Ejemplo n.º 10
0
 /**
  * Perform the main actions of the page.
  * @global array
  */
 protected function action()
 {
     $i2ce_config = I2CE::getConfig()->I2CE;
     parent::action();
     $fields = array("Name" => false, "Company" => false, "Title" => false, "Industry" => false, "Address" => false, "City" => false, "State" => false, "Postal_Code" => false, "Country" => false, "Telephone" => false, "Fax" => false, "Email" => false, "Comments" => false, "referer" => false);
     $valid = true;
     $err_msg = "";
     if ($this->isPost()) {
         $message = "";
         foreach ($fields as $name => $required) {
             if ($required && !I2CE_Validate::checkString($this->post($name))) {
                 $valid = false;
                 $err_msg .= "<li>{$name} is blank.</li>\n";
             }
             $message .= $name . ": " . $this->post($name) . "\n";
         }
         $message .= "Username : "******"\n";
         $message .= "User Role : " . $this->user->getRole() . "\n";
         if ($valid) {
             $this->template->addFile("feedback_thanks.html");
             $this->template->setDisplayData("return_link", 'home');
             I2CE_Mailer::mail($i2ce_config->feedback->to, array('Subject' => $i2ce_config->feedback->subject, 'From' => $this->post('Email')), $message);
             return;
         }
     }
     $this->template->addFile("feedback_form.html");
     if (array_key_exists('contact_address', $this->args) && $this->args['contact_address']) {
         if (($formNode = $this->template->getElementById('feedback_form')) instanceof DOMElement) {
             $formNode->setAttribute('action', 'mailto:' . $this->args['contact_address'] . '?Subject=iHRIS Feedback');
             $formNode->setAttribute('enctype', 'text/plain');
         }
     }
     if (!$valid && $err_msg != "") {
         $this->template->addText('<div id="error">There were some problems with your information:<ul>' . $err_msg . '</ul></div>');
     }
     if ($this->isPost()) {
         foreach ($fields as $name => $required) {
             if ($name == "Comments") {
                 $this->template->addText('<textarea name="Comments" rows="10" cols="45" id="Comments">' . $this->post($name) . '</textarea>', "textarea", $name);
             } else {
                 $this->template->setAttribute("value", $this->post($name), $name, ".");
             }
         }
     } else {
         $this->template->setAttribute("value", $_SERVER['HTTP_REFERER'], "referer", ".");
         if (!array_key_exists('auto_populate', $this->args) || $this->args['auto_populate']) {
             //defaults to true
             foreach (array('email' => 'Email', 'phone' => 'Phone', 'fax' => 'Fax') as $detail => $data) {
                 if (I2CE_User::hasDetail($detail)) {
                     $this->template->setDisplayDataImmediate($data, $this->user->{$detail});
                 }
             }
             $this->template->setDisplayDataImmediate('Name', $this->user->displayName());
         }
     }
 }
 /**
  * Perform the actions for this page
  * @return boolean
  */
 protected function action()
 {
     parent::action();
     $this->setConfig();
     if (!$this->actionExport()) {
         $this->userMessage("There was a problem with exporting the data. Sorry.");
         return false;
     }
     return true;
 }
Ejemplo n.º 12
0
 public function action()
 {
     parent::action();
     if ($this->request_exists('message') && $this->request('message')) {
         $this->template->userMessage($this->request('message'));
     }
     $i2ce_config = I2CE::getConfig()->I2CE;
     $this->user->logout();
     session_destroy();
     $this->redirect('login');
 }
 /**
  * Perform the main actions of the page.
  */
 protected function action()
 {
     parent::action();
     $required_args = array('report_view', 'action_header', 'action_fields', 'action_method', 'action_script');
     foreach ($required_args as $required) {
         if (!array_key_exists($required, $this->args)) {
             I2CE::raiseError("A {$required} must be defined in the page args for I2CE_PageReportAction pages.");
             return false;
         }
     }
     return true;
 }
 /**
  * Perform the main actions of the page.
  * @return boolean
  */
 protected function action()
 {
     if (!parent::action()) {
         I2CE::raiseError("Base action failed");
         return false;
     }
     if (!$this->loadRelationship()) {
         I2CE::raiseError("Could not load relationship");
         return false;
     }
     $this->loadPrimary();
     return $this->action_main();
 }
Ejemplo n.º 15
0
 /**
  * main actions for the page
  * 
  */
 public function action()
 {
     parent::action();
     #$this->template->addHeaderLink('sort_dashboard.js');
     #$this->template->addHeaderLink('display_dashboard.js');
     $this->template->addHeaderLink('swfobject.js');
     $this->template->addHeaderLink('https://www.google.com/jsapi', array('type' => "text/javascript", 'ext' => 'js'), false);
     $this->template->addHeaderText("google.load('visualization', '1.0', {'packages':['corechart']});", 'script', 'vis');
     $this->template->addHeaderLink('QueryWrapper.js');
     $this->template->addHeaderLink('dashboard.css');
     $message = "At least one report view must be defined for the dashboard.";
     $this->displayReportLinks();
 }
 /**
  * Perform page actions 
  * 
  * @returns boolean.  true on success
  */
 protected function action()
 {
     parent::action();
     if (!$this->hasPermission('task(printed_forms_can_access)')) {
         $this->userMessage("You do not have permission to view the requested page");
         $this->redirect("home");
         return false;
     }
     if ($this->request_exists('id') && ($id = $this->request('id'))) {
         $ids = array($this->request('id'));
     } else {
         if ($this->request_exists('ids')) {
             $ids = $this->request('ids');
             if (!is_array($ids)) {
                 $ids = array();
             }
         } else {
             $ids = array();
         }
     }
     if (count($ids) == 0) {
         return false;
     }
     $std_form = false;
     if (count($this->request_remainder) > 0) {
         reset($this->request_remainder);
         $std_form = current($this->request_remainder);
     }
     switch ($this->page) {
         case 'print':
             if ($std_form === false || !$this->action_print($ids, $std_form)) {
                 $this->userMessage("Could not print document {$std_form}");
             }
             return true;
         case 'archive':
             $mf = I2CE_ModuleFactory::instance();
             if (!$this->hasPermission("task(printed_forms_create_all_archives)") || !$mf->isEnabled('BinField') || $std_form === false || !$this->action_archive($ids, $std_form)) {
                 $this->userMessage('Could not archive document');
             }
             $this->setRedirect("PrintedForms/menu?" . http_build_query(array('ids' => $ids)));
             return true;
             //break is intentionally not here. we now fall through to the menu.
         //break is intentionally not here. we now fall through to the menu.
         case 'home':
         case 'menu':
             return $this->action_menu($ids);
         default:
             //do nothing;
     }
     return false;
 }
 /**
  * Perform the main actions of the page.
  */
 protected function action()
 {
     $factory = I2CE_FormFactory::instance();
     if ($this->get_exists('set_status')) {
         $new_status = $this->get('set_status');
         $set_status = $factory->createContainer($this->get('id'));
         $set_status->statusOnly();
         $set_status->setStatus("position_status|" . $new_status);
         $set_status->save($this->user);
         $set_status->cleanup();
         unset($set_status);
     }
     parent::action();
     $this->template->addHeaderLink("view.js");
     $this->template->appendFileById("menu_view.html", "li", "navBarUL", true);
     $this->template->setAttribute("class", "active", "menuConfigure", "a[@href='configure']");
     $this->template->appendFileById("menu_configure.html", "ul", "menuConfigure");
     $this->template->setAttribute("class", "active", "menuLists", "a[@href='lists']");
     if (($jobField = $this->position->getField("job")) instanceof I2CE_FormField) {
         $jobField->setHref("view_job?id=");
     }
     if (($supField = $this->position->getField("supervisor")) instanceof I2CE_FormField) {
         $supField->setHref("view_position?id=");
     }
     if ($this->position->status[1] != "closed") {
         $this->template->appendFileById("view_position_" . $this->position->status[1] . "_link.html", "li", "edit_links");
     }
     $pers_pos_ids = iHRIS_PersonPosition::getIds($this->get('id'));
     //print_r( $pers_pos_ids );
     if (count($pers_pos_ids) > 0 && $pers_pos_ids['record'] != '0') {
         $this->template->appendFileById("view_position_person.html", "div", "position");
         $pers_pos = $factory->createContainer("person_position" . '|' . $pers_pos_ids['record']);
         $pers_pos->populate();
         $this->template->setForm($pers_pos);
         $person = $factory->createContainer($pers_pos_ids['parent']);
         $person->populate();
         $this->template->setForm($person);
     }
     $supervised = $this->position->getSupervised();
     //print_r( $supervised );
     if (count($supervised) > 0) {
         $this->template->appendFileById("view_position_supervised.html", "div", "position");
         foreach ($supervised as $record) {
             $this->template->appendFileById("view_position_row.html", "tr", "supervised");
             $this->template->setDisplayData("position", I2CE_List::lookup($record, "position"));
             $this->template->setDisplayData("add_pos_id", array("id" => $record));
         }
         $this->template->setAttribute("class", "even", "supervised", "tr[position() mod 2 = 0]");
     }
 }
Ejemplo n.º 18
0
 protected function action()
 {
     parent::action();
     switch ($this->page) {
         case 'enable':
             if ($this->isPost()) {
                 $this->actionEnableDisable();
             }
             break;
         case 'modules':
         default:
             $this->actionMenu();
             break;
     }
 }
Ejemplo n.º 19
0
 /**
  * Perform the main actions of the page.
  */
 protected function action()
 {
     parent::action();
     switch ($this->get('action')) {
         case "provider":
             $this->template->addFile("manage_provider.html");
             $this->template->setAttribute("class", "active", "menu_trainingprovider", "a[@href='manage?action=provider']");
             $this->template->appendFileById("menu_manage_provider.html", "ul", "menu_trainingprovider");
             break;
         default:
             $this->template->addFile("manage_people.html");
             $this->template->setAttribute("class", "active", "menuManage", "a[@href='manage']");
             $this->template->appendFileById("menu_manage.html", "ul", "menuManage");
             break;
     }
 }
 protected function action()
 {
     parent::action();
     if ($this->factory instanceof I2CE_SwissConfigFactory) {
         $action = $this->page();
         if ($action == 'update') {
             $action = 'edit';
             if ($this->isPost()) {
                 return $this->factory->updateValues($this->post());
             }
         }
         return $this->factory->displayValues($this->template->getElementById('siteContent'), $this->swiss_path, $action);
     } else {
         return $this->displayModules($this->template->getElementById('siteContent'));
     }
 }
Ejemplo n.º 21
0
 protected function action()
 {
     parent::action();
     if (!$this->factory instanceof I2CE_SwissMagicFactory) {
         $this->setRedirect("./");
         return false;
     }
     $action = $this->page();
     if ($action == 'update') {
         $action = 'edit';
         if ($this->isPost()) {
             return $this->factory->updateValues($this->post());
         }
     }
     return $this->factory->displayValues($this->template->getElementById('siteContent'), $contentNode, $this->swiss_path, $action);
 }
Ejemplo n.º 22
0
 /**
  * Perform the main actions of the page.
  * @global array Get the home page from the global configuration
  */
 protected function action()
 {
     parent::action();
     if ($this->user->logged_in()) {
         $this->setRedirect('home');
         return;
     }
     $access = I2CE::getUserAccess();
     $has_email = $access instanceof I2CE_UserAccess_Mechanism && $access->canChangePassword() && I2CE_User::hasDetail('email');
     $this->template->setBodyId("loginPage");
     $this->template->setDisplayDataImmediate('has_email', $has_email);
     if (!$this->isPost() || !$has_email) {
         return;
     }
     if ($this->post('submit') == "Reset") {
         if (I2CE_Validate::checkString($this->post('username')) && I2CE_User::userExists($this->post('username'), true)) {
             $user = new I2CE_User($this->post('username'), true, false, true);
             $email = $user->email;
             $valid_email = I2CE_Validate::checkEmail($email);
             $pass = trim(I2CE_User::generatePassword());
             if ($user->getRole() != 'guest' && $valid_email && $pass && $user->setPassword($pass)) {
                 if ($this->mailPassword($email, $this->post('username'), $pass)) {
                     $this->template->addTextNode("error_message", "Your password has been reset and mailed to you.");
                 } else {
                     $this->template->addTextNode("error_message", "Your password has been reset, but could not mailed to you. Please contact your system administrator");
                 }
             } else {
                 $this->template->addTextNode("error_message", "Your password could not be reset.  Please contact your system administrator to change your password.");
             }
         } else {
             $this->template->addTextNode("error_message", "Your username could not be found in the database.  Please contact your System Administrator.");
         }
     } elseif ($this->post('submit') == "View") {
         $usernames = I2CE_User::findUsersByInfo(false, array('email' => $this->post('email')));
         if (is_array($usernames) && count($usernames) == 1) {
             reset($usernames);
             $this->template->addText('<p id="error_message">Your username is: <b>' . current($usernames) . '</b><br />Enter it below to reset your password or return to the login page to login.</p>', 'p');
         } else {
             $this->template->addTextNode("error_message", "That email address was not found in the system.  Please contact your System Administrator.");
         }
     } else {
         $this->template->addTextNode("error_message", "Please click one of the submit buttons or only enter one text field.");
     }
 }
 protected function action()
 {
     parent::action();
     $this->template->setAttribute("class", "active", "menuConfigure", "a[@href='configure']");
     $this->template->appendFileById("menu_configure.html", "ul", "menuConfigure");
     $this->template->setAttribute("class", "active", "menuBackgroundProcess", "a[@href='BackgroundProcess']");
     $this->template->addHeaderLink('BackgroundProcess.css');
     $this->process = '';
     if ($this->get_exists('process')) {
         $this->process = $this->get('process');
     }
     if ($this->post_exists('process')) {
         $this->process = $this->post('process');
     }
     if ($this->process && (!array_key_exists('BackgroundProcess', $_SESSION) || !array_key_exists($this->process, $_SESSION['BackgroundProcess']))) {
         $this->template->setDisplayDataImmediate('background_status', 'You do not have access to this process', $mainNode);
         $this->process = '';
     }
     if ($this->process) {
         switch ($this->page) {
             case 'tail':
                 $this->tailProcess();
                 break;
             case 'status':
                 $this->checkStatus();
                 break;
             case 'clear':
                 $this->clear();
                 break;
             default:
                 $mainNode = $this->template->getElementById('siteContent');
                 $this->template->setDisplayDataImmediate('background_tail', '', $mainNode);
                 $this->template->setDisplayDataImmediate('background_status_content', '', $mainNode);
                 //do nothing
                 break;
         }
     } else {
         $mainNode = $this->template->getElementById('siteContent');
         $this->template->setDisplayDataImmediate('background_tail', '', $mainNode);
         $this->template->setDisplayDataImmediate('background_status_content', '', $mainNode);
     }
     $this->processMenu();
     return true;
 }
Ejemplo n.º 24
0
 /**
  * Perform any actions for the page
  * 
  * @return boolean.  true on success
  */
 public function action()
 {
     parent::action();
     $this->template->setAttribute("class", "active", "menuSearch", "a[@href='search']");
     $this->template->appendFileById("menu_recent.html", "ul", "menuSearch");
     $this->template->setAttribute("class", "active", "menuSearch", "ul/li/a[@name='menu_recent']");
     if (I2CE_ModuleFactory::instance()->isEnabled('ihris-common-Search')) {
         $report_config = I2CE::getConfig()->traverse("/modules/CustomReports", true);
         foreach ($report_config->search_reports as $report => $report_info) {
             $node = $this->template->appendFileById("menu_search_report.html", "li", "menu_search_reports");
             $this->template->setDisplayDataImmediate("menu_search_link", array("href" => "search/" . $report, "no_results" => 1), $node);
             $this->template->setDisplayDataImmediate("menu_search_name", $report_info->name, $node);
         }
     }
     if (count($this->request_remainder) > 0) {
         return $this->actionRecent();
     } else {
         return $this->actionMenu();
     }
 }
Ejemplo n.º 25
0
 /**
  * Perform the main actions of the page.
  */
 protected function action()
 {
     function set_cookie($Name, $Value = '', $MaxAge = 0, $Path = '', $Domain = '', $Secure = false, $HTTPOnly = false)
     {
         header('Set-Cookie: ' . rawurlencode($Name) . '=' . rawurlencode($Value) . (empty($MaxAge) ? '' : '; Max-Age=' . $MaxAge) . (empty($Path) ? '' : '; path=' . $Path) . (empty($Domain) ? '' : '; domain=' . $Domain) . (!$Secure ? '' : '; secure') . (!$HTTPOnly ? '' : '; HttpOnly'), false);
     }
     $url = false;
     if (!I2CE::getConfig()->setIfIsSet($url, "/modules/DHIS-Dashboard/urls/web_dash") || !$url) {
         I2CE::raiseError("Bad url for web dashboard: {$url}");
         return false;
     }
     $myCurl = new MyCurl($url);
     $myCurl->useAuth(true);
     $myCurl->setName("admin");
     $myCurl->setPass("district");
     $myCurl->setPost(true);
     $myCurl->setIncludeHeader(true);
     $myCurl->createCurl($url);
     $data = $myCurl->getWebpage();
     // In this case, I am only passing along the PHPSESSID, but you will likely want to pass along everything.
     $cstart = strpos($data, "JSESSIONID");
     $cend = strpos($data, ";", $cstart) - $cstart;
     $cookie = substr($data, $cstart, $cend);
     // Likewise.
     $cookie = explode('=', $cookie);
     $cookie_domain = false;
     $cookie_path = false;
     if (!I2CE::getConfig()->setIfIsSet($cookie_domain, "/modules/DHIS-Dashboard/cookie/domain") || !$domain) {
         I2CE::raiseError("No domain set for cookie");
         return false;
     }
     if (!I2CE::getConfig()->setIfIsSet($cookie_path, "/modules/DHIS-Dashboard/cookie/path") || !$path) {
         I2CE::raiseError("No path set for cookie");
         return false;
     }
     set_cookie('JSESSIONID', $cookie[1], time() + 6000, $cookie_path, $cookie_domain, 0);
     //echo $_COOKIE['JSESSIONID'];
     $this->template->setAttribute("class", "active", "menuDashboard", "a[@href='sagar']");
     parent::action();
 }
Ejemplo n.º 26
0
 /**
  * Perform the main actions of the page.
  */
 protected function action()
 {
     parent::action();
     $this->loadObjects();
     $orderBy = array();
     $form = $this->get('form');
     $config = I2CE::getConfig();
     $title = "";
     $config->setIfIsSet($title, "/modules/forms/forms/{$form}/display");
     if ($this->get_exists('order_by')) {
         $orders = $this->get('order_by');
         if (is_array($orders) && array_key_exists($form, $orders) && is_array($orders[$form])) {
             $orderBy[$form] = array_keys($orders[$form]);
         }
     }
     $this->history->populateChildren($form, $orderBy);
     $this->template->setForm($this->history);
     $this->template->setDisplayData("history_header", $title . " History");
     if (count($this->history->children) > 0) {
         foreach ($this->history->children as $form => $list) {
             foreach ($list as $i => $obj) {
                 if ($i == 0) {
                 } else {
                     $this->template->appendFileById("hr.html", "hr", "history");
                 }
                 $node = $this->template->appendFileById("view_" . $this->getPrefix() . $form . ".html", "div", "history");
                 $this->template->setForm($obj, $node);
             }
         }
         /**
          * Since each view_form template includes editing information it can be stripped out
          * for the historical view.
          */
         if (!$this->get_exists('show_edit')) {
             $this->template->findAndRemoveNodes("//div[@class='editRecord']");
         }
         $this->template->findAndRemoveNodes("//span[@history='false']");
     }
 }
 /**
  * Perform the main actions of the page.
  */
 protected function action()
 {
     parent::action();
     if ($this->get_exists('delete')) {
         if (!$this->hasPermission('task(person_can_delete_child_form_salary)')) {
             $this->userMessage("You do not have permission to delete the salary");
             return false;
         }
         $personId = $this->deleteSalary();
         if ($personId > 0) {
             $this->redirect("salary_history?id={$personId}");
         } else {
             $this->redirect('');
         }
         return;
     }
     if (!$this->hasPermission('task(person_can_view_child_form_salary)')) {
         $this->userMessage("You do not have permission to view the salaries");
         return false;
     }
     return $this->showSalaryHistory();
 }
Ejemplo n.º 28
0
 /**
  * Perform the main actions of the page.
  */
 protected function action()
 {
     parent::action();
     $this->template->addHeaderLink("view.js");
     $this->template->appendFileById("menu_view.html", "li", "navBarUL", true);
     $this->template->setAttribute("class", "active", "menuConfigure", "a[@href='configure']");
     $this->template->appendFileById("menu_configure.html", "ul", "menuConfigure");
     $this->template->setAttribute("class", "active", "menuLists", "a[@href='lists']");
     $factory = I2CE_FormFactory::instance();
     $job = $factory->createContainer($this->get('id'));
     $job->populate();
     $this->template->setForm($job);
     $positions = $job->getPositions();
     //print_r( $supervised );
     if (count($positions) > 0) {
         $this->template->appendFileById("view_job_positions.html", "div", "job");
         foreach ($positions as $record) {
             $this->template->appendFileById("view_position_row.html", "tr", "positions");
             $this->template->setDisplayData("position", I2CE_List::lookup($record, "position"));
             $this->template->setDisplayData("add_pos_id", array("id" => "position|" . $record));
         }
         $this->template->setAttribute("class", "even", "positions", "tr[position() mod 2 = 0]");
     }
 }
 /**
  * Perform the main actions of the page.
  * @return boolean
  */
 protected function action()
 {
     if (!parent::action()) {
         return false;
     }
     if (!$this->hasPermission("role(admin)")) {
         $this->userMessage("You do not have permission to view this page.");
         return false;
     }
     $pos_mech = I2CE_FormStorage::getStorageMechanism("position");
     $pers_pos_mech = I2CE_FormStorage::getStorageMechanism("person_position");
     if (!$pos_mech instanceof I2CE_FormStorage_entry || !$pers_pos_mech instanceof I2CE_FormStorage_entry) {
         I2CE::raiseMessage("Invalid storage type for position and person position forms. " . get_class($pos_mech) . get_class($pers_pos_mech));
         $this->template->addFile("mass_delete_by_search_error_invalid.html");
         return true;
     }
     $people = $this->post('people');
     if (!is_array($people) || count($people) < 1) {
         $this->template->addFile("mass_delete_by_search_empty.html");
     } else {
         $step = 'choose';
         if ($this->post_exists('step')) {
             $step = $this->post('step');
         }
         if ($step == "delete") {
             if ($this->post('yes') != 'yes') {
                 $this->template->appendFileById("mass_delete_by_search_error_yes.html", "p", "error");
                 $step = "confirm";
             }
             $userAccess = new I2CE_UserAccess_Mechanism();
             if (!$this->post_exists('admin_pass') || !$userAccess->userHasPassword('i2ce_admin', $this->post('admin_pass'))) {
                 $this->template->appendFileById("mass_delete_by_search_error_password.html", "p", "error");
                 $step = "confirm";
             }
         }
         switch ($step) {
             case "choose":
                 $this->template->addFile("mass_delete_by_search_form.html");
                 $msgNode = $this->template->addFile("mass_delete_by_search_confirm_message.html");
                 foreach ($people as $person) {
                     $persObj = I2CE_FormFactory::instance()->createContainer($person);
                     $persObj->populate();
                     $persNode = $this->template->appendFileById("mass_delete_by_search_each.html", "li", "search_list");
                     $this->template->setDisplayDataImmediate("people[]", array('value' => $person, 'id' => "check_{$person}"), $persNode);
                     $this->template->setDisplayDataImmediate("person_name", $persObj->surname . ', ' . $persObj->firstname, $persNode);
                     $label = $this->template->query("label[@name='search_label']", $persNode);
                     if ($label->length == 1) {
                         $label->item(0)->setAttribute("for", "check_{$person}");
                     }
                 }
                 break;
             case "confirm":
                 $list = $this->getDeleteList($people);
                 if ($list === null) {
                     $this->template->addFile("mass_delete_by_search_error_notfound.html");
                 } elseif (count($list) < 1) {
                     I2CE::raiseMessage("Invalid return data from getDeleteList!");
                     $this->template->addFile("mass_delete_by_search_error_unkonwn.html");
                 } else {
                     $formNode = $this->template->addFile("mass_delete_by_search_form.html");
                     $this->template->setDisplayDataImmediate("step", "delete");
                     $addNode = $this->template->addFile("mass_delete_by_search_authenticate_form.html");
                     $would_delete = I2CE_FormStorage_entry::massDelete($list, array());
                     $msgNode = $this->template->addFile("mass_delete_by_search_delete_count.html");
                     $this->template->setDisplayDataImmediate("delete_count", $would_delete, $msgNode);
                     foreach ($people as $person) {
                         $persObj = I2CE_FormFactory::instance()->createContainer($person);
                         $persObj->populate();
                         $persNode = $this->template->appendFileById("mass_delete_by_search_each_final.html", "li", "search_list");
                         $this->template->setDisplayDataImmediate("people[]", $person, $persNode);
                         $this->template->setDisplayDataImmediate("person_name", $persObj->surname . ', ' . $persObj->firstname, $persNode);
                     }
                 }
                 break;
             case "delete":
                 $list = $this->getDeleteList($people);
                 if ($list === null) {
                     $this->template->addFile("mass_delete_by_search_error_notfound.html");
                 } elseif (count($list) < 1) {
                     I2CE::raiseMessage("Invalid return data from getDeleteList!");
                     $this->template->addFile("mass_delete_by_search_error_unkonwn.html");
                 } else {
                     $formNode = $this->template->addFile("mass_delete_by_search_form.html");
                     $this->template->setDisplayDataImmediate("step", "delete");
                     $addNode = $this->template->addFile("mass_delete_by_search_authenticate_form.html");
                     I2CE_ModuleFactory::callHooks("pre_mass_delete_person", $people, $this->post());
                     if (($deleted = I2CE_FormStorage_entry::massDelete($list, array(), false)) !== false) {
                         $node = $this->template->addFile("mass_delete_by_search_success.html");
                         $this->template->setDisplayDataImmediate("delete_count", $deleted, $node);
                         if (I2CE_ModuleFactory::instance()->isEnabled("CachedForms")) {
                             $forms = I2CE_FormFactory::instance()->getNames();
                             $success = array();
                             $failure = array();
                             foreach ($forms as $form) {
                                 try {
                                     $cachedForm = new I2CE_CachedForm($form);
                                 } catch (Exception $e) {
                                     $success[] = $form;
                                     continue;
                                 }
                                 if (!$cachedForm->dropTable()) {
                                     $failure[] = $form;
                                 }
                             }
                             if (count($failure) > 0) {
                                 $this->template->addFile("mass_delete_by_search_cache_fail.html", "p");
                             } else {
                                 $this->template->addFile("mass_delete_by_search_cache_success.html", "p");
                             }
                         }
                     } else {
                         I2CE::raiseError("An error occurred trying to mass delete by search.");
                         $this->template->addFile("mass_delete_by_search_error_unkonwn.html");
                     }
                 }
                 break;
         }
     }
 }
 /**
  * Perform any actions for the page
  * 
  * @returns boolean.  true on sucess
  */
 public function action()
 {
     parent::action();
     if (!$this->hasPermission('task(custom_reports_can_access)')) {
         return false;
     }
     $msgs = array('not_generated' => 'Could not generate report', 'not_saved' => 'Could not save display options', 'saved' => 'Saved display options');
     foreach ($msgs as $k => &$v) {
         I2CE::getConfig()->setIfIsSet($v, "/modules/CustomReports/text/user_messages/{$k}");
     }
     if ($this->page === 'delete') {
         return $this->actionDelete();
     }
     if ($this->page === 'generate') {
         $this->setRedirect('CustomReports/edit/reports');
         if (!$this->actionGenerate(false)) {
             $msg = $msgs['not_generated'];
             I2CE::raiseError($msg);
             $this->userMessage($msg, 'notice');
             return false;
         }
         return true;
     }
     if ($this->page === 'generate_force') {
         $this->setRedirect('CustomReports/edit/reports');
         if (!$this->actionGenerate(true)) {
             $msg = $msgs['not_generated'];
             I2CE::raiseError($msg);
             $this->userMessage($msg, 'notice');
             return false;
         }
         return true;
     }
     $this->template->addHeaderLink("CustomReports.css");
     $this->template->addHeaderLink("CustomReports_iehacks.css", array('ie6' => true));
     $which = false;
     if ($this->page === 'saveOptions') {
         if (!$this->actionSaveOptions()) {
             $this->userMessage($msgs['not_saved'], 'notice', false);
             //message is not delayed as we are showing below
         } else {
             $this->userMessage($msgs['saved'], 'notice', false);
             //message is not delayed as we are showing below
         }
         reset($this->request_remainder);
         return $this->actionShow(array(current($this->request_remainder)));
         //display the default page
     }
     if ($this->page === 'show') {
         $this->template->setAttribute("class", "active", "menuCustomReports", "a[@href='CustomReports/view/reportViews']");
         return $this->actionShow($this->request_remainder);
     }
     if (array_key_exists(0, $this->request_remainder)) {
         $which = $this->request_remainder[0];
         $handledByFactory = $this->tryFactory($which);
         if ($handledByFactory !== 'not_handled') {
             return $handledByFactory !== false;
         }
     }
     return true;
 }