Пример #1
0
    /**
     * Add javascript logout to the page if a timeout is set for the site.
     * @param I2CE_Page $page
     */
    public function javascriptTimeout($page)
    {
        if (!$page->getUser()->logged_in()) {
            return;
        }
        $timeout = 0;
        I2CE::getConfig()->setIfIsSet($timeout, "/config/site/user_timeout");
        I2CE::getConfig()->setIfIsSet($timeout, "/user_prefs/timeout/user_timeout");
        if ($timeout && is_numeric($timeout) && $timeout > 0) {
            $timeout = $timeout * 1000;
            $message = "You have been logged out due to inactivity.";
            I2CE::getConfig()->setIfIsSet($message, "/config/site/user_timeout_message");
            I2CE::getConfig()->setIfIsSet($message, "/user_prefs/timeout/user_timeout_message");
            $logout = $page->getAccessedBaseURL() . "logout?message=" . urlencode($message);
            $js = <<<EOJS
var auto_logout_timeout_id = 0;
window.addEvent('domready', function() { 
        autoLogoutResetTimeout(); 
        document.addEvent('keypress', function(event) { autoLogoutResetTimeout(); } );
        document.addEvent('mousemove', function(event) { autoLogoutResetTimeout(); } );
        } );
function autoLogoutResetTimeout() {
    if ( auto_logout_timeout_id > 0 ) {
        clearTimeout( auto_logout_timeout_id );
    }
    auto_logout_timeout_id = setTimeout( function() { window.location = "{$logout}"; }, {$timeout} );
}
EOJS;
            $template = $page->getTemplate();
            $template->addHeaderLink("mootools-core.js");
            $template->addHeaderText($js, "script", true);
        }
    }
 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);
 }
Пример #3
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 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);
 }
 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();
         }
     }
 }
 /**
  * Create a new instance of a page.
  * 
  * The default constructor should be called by any pages extending this object.  It creates the
  * {@link I2CE_Template} and {@link I2CE_User} objects and sets up the basic member variables.
  * @param array $args
  * @param array $request_remainder The remainder of the request path
  */
 public function __construct($args, $request_remainder, $get = null, $post = null)
 {
     $this->cli = new I2CE_CLI();
     $this->cli->addUsage("[--delete=XXXX]: The form|id to delete.  If not set, then user will be prompted.\n");
     parent::__construct($args, $request_remainder, $get, $post);
     $this->cli->processArgs();
 }
 /**
  * Create a new instance of a page.
  * 
  * The default constructor should be called by any pages extending this object.  It creates the
  * {@link I2CE_Template} and {@link I2CE_User} objects and sets up the basic member variables.
  * @param array $args
  * @param array $request_remainder The remainder of the request path
  */
 public function __construct($args, $request_remainder, $get = null, $post = null)
 {
     parent::__construct($args, $request_remainder, $get, $post);
     $this->form_factory = I2CE_FormFactory::instance();
     $this->check_map = I2CE_ModuleFactory::instance()->isEnabled("Lists");
     $this->locale = I2CE_Locales::DEFAULT_LOCALE;
 }
 /**
  * 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);
 }
Пример #10
0
 public function ajaxTest($page)
 {
     if (!isset($_SESSION['stub_ajax_test'])) {
         $_SESSION['stub_ajax_test'] = 'unknown0';
     }
     if (is_bool($_SESSION['stub_ajax_test'])) {
         return;
     }
     if (preg_match('/^unknown(\\d*)/', $_SESSION['stub_ajax_test'], $matches)) {
         if ($matches[1] > 5) {
             $_SESSION['stub_ajax_test'] = false;
             //assume after 5 page request we never got a response
         } else {
             $matches[1]++;
             $_SESSION['stub_ajax_test'] = 'unknown' . $matches[1];
         }
     } else {
         $_SESSION['stub_ajax_test'] = 'unknown0';
     }
     $stub_url = I2CE_Page::getAccessedBaseURL() . "/stub-ajax";
     $startJS = "\nvar Stub_Ajax_Test = {\n   start: function(){   \n        new Request.HTML({url:'{$stub_url}'}).get();\n   }\n};\nwindow.addEvent('load',Stub_Ajax_Test.start);\n";
     $template = $page->getTemplate();
     $template->addHeaderLink('mootools-core.js');
     $template->addHeaderText($startJS, 'script', "stub_ajax_test");
 }
 /**
  * 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;
 }
Пример #13
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);
 }
Пример #14
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;
 }
Пример #16
0
 protected function _display($supress_output = false)
 {
     $this->template->addHeaderLink('mootools-core.js');
     $this->template->addHeaderLink('mootools-more.js');
     parent::_display($supress_output);
     if ($errors = I2CE_Dumper::cleanlyEndOutputBuffers()) {
         I2CE::raiseError("Errors:\n" . $errors);
     }
     $this->ff = I2CE_FormFactory::instance();
     if (!$this->request_exists('id') || !($formid = $this->request('id'))) {
         $this->pushError("Bad list id {$id}");
         //needs to be localized
         return false;
     }
     $success = true;
     list($form, $id) = array_pad(explode("|", $formid, 2), 2, '');
     I2CE::raiseError(print_r($this->request(), true));
     if ($id == '*') {
         $where = array('operator' => 'FIELD_LIMIT', 'field' => 'remap', 'style' => 'not_null', 'data' => array());
         $ids = I2CE_FormStorage::search($form, false, $where);
         I2CE::raiseError("Form {$form} has remapping data for " . implode(" ", $ids));
         if (count($ids) > 0) {
             foreach (I2CE_List::getFieldsMappingToList($form) as $rform => $fields) {
                 foreach ($fields as $fieldObj) {
                     $field = $fieldObj->getName();
                     foreach ($ids as $id) {
                         I2CE::raiseError("Checking for remaps on {$rform}+{$field}");
                         $success &= $this->doRemap($rform, $field, $form . '|' . $id);
                     }
                 }
             }
         }
         $url = "index.php/auto_list?form=" . $form;
     } else {
         $form = '';
         if (!$this->request_exists('form') || !($form = $this->request('form')) || !in_array($form, $this->ff->getForms())) {
             $this->pushError("Form {$form} not found");
             return false;
         }
         $field = '';
         if (!$this->request_exists('field') || !($field = $this->request('field'))) {
             $this->pushError("Bad Field {$field}");
             return false;
         }
         $success = $this->doRemap($form, $field, $formid);
         $url = "index.php/auto_list?id={$formid}&form=" . $form;
     }
     if ($success) {
         $this->pushContent("Data was succesully remapped.  Continue on to database lists <a href='{$url}'>site</a>?");
     } else {
         $this->pushContent("Data was <b>not</b> succesully remapped.  Continue on to database lists <a href='{$url}'>site</a>?");
     }
     return true;
 }
Пример #17
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;
 }
 /**
  * Create a new instance of a page.
  * 
  * The default constructor should be called by any pages extending this object.  It creates the
  * {@link I2CE_Template} and {@link I2CE_User} objects and sets up the basic member variables.
  * @param array $args
  * @param array $request_remainder The remainder of the request path
  */
 public function __construct($args, $request_remainder, $get = null, $post = null)
 {
     $this->cli = new I2CE_CLI();
     $this->cli->addUsage("[--relationship=XXXX]: The relationship to export.  If not set, then user will be prompted.\n");
     $this->cli->addUsage("[--description=XXXX]: Optional description to use in the  export\n");
     $this->cli->addUsage("[--version=XXXX]: Optional version to use in the  export\n");
     $this->cli->addUsage("[--display=XXXX]: Optional display name to use in the  export\n");
     $this->cli->addUsage("[--module=XXXX]: Optional module name to use in the  export\n");
     $this->cli->addUsage("[--output=XXXX]: Optional file to ouput to.  \n");
     parent::__construct($args, $request_remainder, $get, $post);
     $this->cli->processArgs();
 }
 public function displayValues($content_node, $transient_options, $action)
 {
     if (!($mainNode = $this->template->appendFileByNode('swiss_svs_lists.html', 'div', $content_node)) instanceof DOMNode || !($listNode = $this->template->getElementByName('lists', 0, $mainNode)) instanceof DOMNode) {
         return false;
     }
     $publish_text = 'Publish a new version';
     $retrieve_text = 'Retrieve the most recent version';
     $edit_text = 'Edit %s configuration';
     $other_text = 'Other Versions:';
     $based_on_form_text = 'Based on the list %s';
     I2CE::getConfig()->setIfIsSet($publish_text, "/modules/SVS/messages/publish");
     I2CE::getConfig()->setIfIsSet($retrieve_text, "/modules/SVS/messages/retrieve");
     I2CE::getConfig()->setIfIsSet($edit_text, "/modules/SVS/messages/edit");
     I2CE::getConfig()->setIfIsSet($other_text, "/modules/SVS/messages/other");
     I2CE::getConfig()->setIfIsSet($based_on_form_text, "/modules/SVS/messages/basd_on_form_style");
     foreach ($this->storage->getKeys() as $oid) {
         if (!($swissChild = $this->getChild($oid)) instanceof I2CE_Swiss_SVS) {
             continue;
         }
         $form = $swissChild->getField('list');
         $id = 'list_' . $oid;
         $listNode->appendChild($liNode = $this->template->createElement('li'));
         $liNode->appendChild($spanNode = $this->template->createElement('span', array('id' => $id)));
         $spanNode->appendChild($aNode = $this->template->createElement('a', array('id' => $id . '_link')));
         $aNode->appendChild($this->template->createElement('h3', array(), sprintf($edit_text, $oid)));
         if ($form) {
             $spanNode->appendChild($pNode = $this->template->createElement('p', array(), sprintf($based_on_form_text, $form)));
         }
         $spanNode->appendChild($divNode = $this->template->createElement('div', array('id' => $id . '_ajax', 'class' => 'indented')));
         $spanNode->appendChild($linkDivNode = $this->template->createElement('div', array('class' => 'indented')));
         $publish = I2CE_Page::getAccessedBaseURL() . '/SVS/publish?id=' . $oid;
         $retrieve = I2CE_Page::getAccessedBaseURL() . '/SVS/RetrieveValueSet?id=' . $oid;
         $linkDivNode->appendChild($this->template->createElement('a', array('href' => $publish), $publish_text));
         $linkDivNode->appendChild($this->template->createElement('br'));
         $versions = iHRIS_SVS::getVersions($oid);
         if (count($versions) > 0) {
             $linkDivNode->appendChild($this->template->createElement('a', array('href' => $retrieve), $retrieve_text));
             $linkDivNode->appendChild($this->template->createElement('br'));
             $linkDivNode->appendChild($this->template->createTextNode($other_text));
             sort($versions);
             foreach ($versions as $i => $version) {
                 if ($i != 0) {
                     $linkDivNode->appendChild($this->template->createTextNode(','));
                 }
                 $linkDivNode->appendChild($this->template->createElement('a', array('href' => $retrieve . '&version=' . $version), " {$version} "));
             }
         }
         $linkDivNode->appendChild($this->template->createElement('pre', array(), $retrieve));
         $swissChild->addAjaxLink($id . '_link', 'contents', $id . '_ajax', $spanNode, $action, $transient_options);
     }
     return true;
 }
Пример #21
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 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();
 }
 /**
  * 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;
 }
 /**
  * Add alerts to the page
  * @param I2CE_Page $page
  */
 public function add_alerts($page)
 {
     if (!$page instanceof I2CE_Page) {
         return;
     }
     $config = I2CE::getConfig()->traverse("/modules/UserAlerts/display");
     $user = I2CE_FormFactory::instance()->createContainer("user|" . $page->getUser()->username);
     $alerts = $user->getChildIds("user_alert");
     $alert_count = count($alerts);
     if ($alert_count == 0) {
         return;
     }
     $pend_where = array('operator' => 'FIELD_LIMIT', 'field' => 'time_ack', 'style' => 'null');
     $pending = $user->getChildIds("user_alert", array(), $pend_where);
     $pend_count = count($pending);
     $append_id = 'sysUser';
     $config->setIfIsSet($append_id, "append_id");
     $append_tag = 'li';
     $config->setIfIsSet($append_tag, "append_tag");
     $append_before = true;
     $config->setIfIsSet($append_before, "append_before");
     $pending_style = 'alerts_pending';
     $config->setIfIsSet($pending_style, "pending_style");
     $default_style = 'alerts_seen';
     $config->setIfIsSet($default_style, "default_style");
     $template_file = 'user_alert_link.html';
     $config->setIfIsSet($template_file, "append_file");
     if ($pend_count > 0) {
         $style = $pending_style;
     } else {
         $style = $default_style;
     }
     $template = $page->getTemplate();
     $alert = $template->appendFileById($template_file, $append_tag, $append_id, $append_before);
     $alert->setAttribute("class", $style);
     $template->setDisplayDataImmediate("alert_pending_count", $pend_count, $alert);
     $template->setDisplayDataImmediate("alert_total_count", $alert_count, $alert);
 }
 /**
  * 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]");
     }
 }
Пример #26
0
 public function getMeta()
 {
     $meta = I2CE::getConfig()->getAsArray("/modules/SVS/lists/" . $this->oid . "/meta");
     if (!is_array($meta)) {
         $meta = array();
     }
     $req_keys = array('displayName' => $this->listObj->getDisplayName(), 'Status' => 'Active', 'Source' => 'iHRIS', 'SourceURI' => I2CE_Page::getAccessedBaseURL(), 'Type' => 'Expanded');
     I2CE::getConfig()->setIfIsSet($meta['Source'], "/config/site/module");
     foreach ($req_keys as $key => $val) {
         if (!array_key_exists($key, $meta) || !$meta[$key]) {
             $meta[$key] = $val;
         }
     }
     return $meta;
 }
Пример #27
0
 protected function action()
 {
     parent::action();
     switch ($this->page) {
         case 'enable':
             if ($this->isPost()) {
                 $this->actionEnableDisable();
             }
             break;
         case 'modules':
         default:
             $this->actionMenu();
             break;
     }
 }
 public function __construct($args, $request_remainder, $get = null, $post = null)
 {
     parent::__construct($args, $request_remainder, $get, $post);
     if (array_key_exists('il_hwr_host', $this->args) && is_scalar($this->args['il_hwr_host'])) {
         $this->il_hwr_host = $this->args['il_hwr_host'];
     }
     if ($this->request_exists('id')) {
         $id = $this->request('id');
         I2CE::raiseError("Recevied ({$id})");
         if (($this->person = I2CE_FormFactory::instance()->createContainer($id)) instanceof I2CE_Form) {
             $this->person->populate();
         }
     }
     $this->setForm($this->person);
 }
Пример #29
0
 /**
  * Create a new instance of a page.
  * 
  * The default constructor should be called by any pages extending this object.  It creates the
  * {@link I2CE_Template} and {@link I2CE_User} objects and sets up the basic member variables.
  * @param array $args
  * @param array $request_remainder The remainder of the request path
  */
 public function __construct($args, $request_remainder, $get = null, $post = null)
 {
     $this->config = I2CE::getConfig()->modules->admin->cron;
     $this->types = $this->config->types->getAsArray();
     $this->cli = new I2CE_CLI();
     $this->cli->addUsage("[--type=XXXX]: The type of cron to run.  If not set, the system will determine\n");
     $this->cli->addUsage("               what to run based on recent run times.\n");
     $this->cli->addUsage("               Possible values are:  " . implode(', ', array_keys($this->types)) . "\n");
     $this->cli->addUsage("               If the most recently run cron hasn't finished for a type then it\n");
     $this->cli->addUsage("               will not run again.\n");
     $this->cli->addUsage("[--silent=true|false]: Determine if standard messages will be shown or not.\n");
     $this->cli->addUsage("                       Defaults to: false\n");
     parent::__construct($args, $request_remainder, $get, $post);
     $this->cli->processArgs();
 }
 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'));
     }
 }