当前位置: 首页>>代码示例>>PHP>>正文


PHP I2CE_ModuleFactory::instance方法代码示例

本文整理汇总了PHP中I2CE_ModuleFactory::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP I2CE_ModuleFactory::instance方法的具体用法?PHP I2CE_ModuleFactory::instance怎么用?PHP I2CE_ModuleFactory::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在I2CE_ModuleFactory的用法示例。


在下文中一共展示了I2CE_ModuleFactory::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: search

 /**
  * Find a file (or directory) of a certain category
  * @param string $category  the category of the file
  * @param string $file_name the file name of the file we wish to find
  * @param boolean $find_all Defatults to false
  * @returns mixed.  Returns either a string which is the path and file name of the file 
  * we found, or null if we did not find the file.
  */
 public function search($category, $file_name, $find_all = false)
 {
     if (!array_key_exists($category, $this->ordered_paths)) {
         $factory = I2CE_ModuleFactory::instance();
         $factory->loadPaths(null, $category, false, $this);
     }
     if ($find_all || $this->stale_time < 0) {
         return parent::search($category, $file_name, $find_all);
     }
     if (array_key_exists($category, $this->preferred_locales) && is_array($this->preferred_locales[$category])) {
         $locales = $this->preferred_locales[$category];
     } else {
         $locales = I2CE_Locales::getPreferredLocales();
     }
     if (array_key_exists('I2CE_FileSearch_Caching', $_SESSION) && is_array($_SESSION['I2CE_FileSearch_Caching']) && array_key_exists($category, $_SESSION['I2CE_FileSearch_Caching']) && is_array($_SESSION['I2CE_FileSearch_Caching'][$category]) && array_key_exists($file_name, $_SESSION['I2CE_FileSearch_Caching'][$category]) && is_array($_SESSION['I2CE_FileSearch_Caching'][$category][$file_name])) {
         $data = $_SESSION['I2CE_FileSearch_Caching'][$category][$file_name];
         if (array_key_exists('time', $data) && array_key_exists('location', $data) && array_key_exists('locale', $data)) {
             if (is_readable($data['location']) && time() - $data['time'] < $this->stale_time) {
                 $this->found_locales = $data['locale'];
                 return $data['location'];
             } else {
                 unset($_SESSION['I2CE_FileSearch_Caching'][$category][$file_name]);
             }
         }
     }
     //did not find the file
     $location = parent::search($category, $file_name, false);
     if (!is_string($location) || strlen($location) == 0) {
         return null;
     }
     $_SESSION['I2CE_FileSearch_Caching'][$category][$file_name] = array('time' => time(), 'location' => $location, 'locale' => $this->found_locales);
     return $location;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:41,代码来源:I2CE_FileSearch_Caching.php

示例2: instance

 /**
  * Return the instance of this factory and create it if it doesn't exist.
  * @return I2CE_ModuleFactory
  */
 public static function instance()
 {
     if (!self::$instance instanceof I2CE_ModuleFactory) {
         self::$instance = new I2CE_ModuleFactory();
     }
     return self::$instance;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:11,代码来源:I2CE_ModuleFactory.php

示例3: validate

 /**
  * Validate this form.
  */
 public function validate()
 {
     if (I2CE_Validate::checkNumber($this->count, 1)) {
         if (!$this->code_start || !I2CE_Validate::checkNumber($this->code_start, 0)) {
             $this->setInvalidMessage('code_start', 'required');
         }
         if ($this->code_format != "") {
             if (preg_match('/%[\\d\\.]*d/', $this->code_format) == 0) {
                 $this->code_format .= "%d";
             }
             $storage = I2CE_ModuleFactory::instance()->getClass("forms-storage");
             if ($storage instanceof I2CE_FormStorage) {
                 $count = $this->count;
                 $code_start = $this->code_start;
                 while ($count--) {
                     $this->code = sprintf($this->code_format, $code_start);
                     $storage->validate_formfield($this->getField("code"));
                     if ($this->getField("code")->hasInvalid()) {
                         $this->setInvalidMessage("code_format", 'unique');
                     }
                     $code_start++;
                 }
             }
         }
     }
     parent::validate();
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:30,代码来源:iHRIS_MultiPosition.php

示例4: __construct

 /**
  * Create a new instance of a I2CE_FormField
  * @param string $name
  * @param array $options A list of options for this form field.
  */
 public function __construct($name, $options)
 {
     parent::__construct($name, $options);
     $this->use_date_picker = I2CE_ModuleFactory::instance()->isEnabled('DatePicker');
     $this->start_year = 0;
     $this->end_year = 0;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:12,代码来源:I2CE_FormField_DB_DATE.php

示例5: loadRelationship

 public function loadRelationship()
 {
     $rel_base = '/modules/CustomReports/relationships';
     if (!array_key_exists('relationship', $this->args) || !is_scalar($this->args['relationship'])) {
         I2CE::raiseError("Invalid relationship");
         return false;
     }
     if (array_key_exists('relationship_base', $this->args) && is_scalar($this->args['relationship_base'])) {
         $rel_base = $this->args['relationship_base'];
     }
     $use_cache = true;
     if (array_key_exists('use_cache', $this->args)) {
         $use_cache = $this->args['use_cache'];
     }
     if ($this->request_exists('use_cache')) {
         $use_cache = $this->request('use_cache');
     }
     $use_cache &= I2CE_ModuleFactory::instance()->isEnabled('CachedForms');
     if ($use_cache) {
         $cache_callback = array('I2CE_CachedForm', 'getCachedTableName');
     } else {
         $cache_callback = null;
     }
     try {
         $this->formRelationship = new I2CE_FormRelationship($this->args['relationship'], $rel_base, $cache_callback);
     } catch (Exception $e) {
         I2CE::raiseError("Could not create form relationship : " . $this->args['relationship']);
         return false;
     }
     if (!array_key_exists('use_display_fields', $this->args) || !$this->args['use_display_fields']) {
         $this->formRelationship->useRawFields();
     }
     return true;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:34,代码来源:I2CE_PageXMLRelationshipSingle.php

示例6: __construct

 /**
  * 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;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:15,代码来源:I2CE_Page_FormDocumentor.php

示例7: upgrade

 /**
  * Run the upgrade for this module.  
  * @param string $old_vers
  * @param string $new_vers
  * @return boolean
  */
 public function upgrade($old_vers, $new_vers)
 {
     if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.5')) {
         I2CE::raiseError("Disabling training module.");
         I2CE_ModuleFactory::instance()->disable(array("manage-training-simple-competency", "manage-training-institution", "manage-training-course", "training-simple-competency", "training-institution", "training-course"));
     }
     return parent::upgrade($old_vers, $new_vers);
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:14,代码来源:iHRIS_Module_ManageSiteDemo.php

示例8: __construct

 public function __construct()
 {
     parent::__construct();
     $this->js = '';
     if (I2CE_ModuleFactory::instance()->isEnabled('StretchPage')) {
         $this->js .= 'if ( PageStretch ) { PageStretch.stretchPage(); }';
     }
     $this->js_func = '';
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:9,代码来源:I2CE_Stub.php

示例9: __construct

 /**
  * Constructor -- called from page wrangler for URL of form admin/(module_name)/action/arg1/arg2
  * @param string $shortname A module name to show the admin page for. Defaults to null to mean no module.
  * @param string $action The action this pages is to perform
  * @param array $args an array of strings
  * @param string $message. A message to display on the page.  Defaults to null
  */
 public function __construct($args, $request_remainder)
 {
     parent::__construct($args, $request_remainder);
     if (count($request_remainder) == 0) {
         $this->shortname = 'I2CE';
     } else {
         $this->shortname = array_shift($request_remainder);
     }
     $this->mod_factory = I2CE_ModuleFactory::instance();
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:17,代码来源:I2CE_PageAdmin.php

示例10: userRequestSave

 public static function userRequestSave($form, $user, $transact = true)
 {
     if (!$form instanceof I2CE_User_Request) {
         return false;
     }
     $mf = I2CE_ModuleFactory::instance();
     $fs = $mf->getClass("forms-storage");
     if (!$fs instanceof I2CE_FormStorage) {
         return false;
     }
     return $fs->save($form, $user, $transact);
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:12,代码来源:I2CE_Module_UserRequest.php

示例11: action

 /**
  * Perform the main actions of the page.
  */
 protected function action()
 {
     $factory = I2CE_FormFactory::instance();
     $this->template->setAttribute("class", "active", "menuManage", "a[@href='manage']");
     $this->template->appendFileById("menu_manage.html", "ul", "menuManage");
     switch ($this->get('action')) {
         case "review":
             if (I2CE_ModuleFactory::instance()->isEnabled("ihris-manage-Application")) {
                 $this->template->setAttribute("class", "active", "menuManage", "//li/a[@href='manage?action=review']");
                 $this->template->addFile("applicant_review.html");
                 if ($this->get_exists('position')) {
                     $position_data = explode('|', $this->get('position'), 2);
                     $position_id = $position_data[1];
                     $this->template->setDisplayData("return_link", array("action" => "review"));
                     $this->template->addFile("applicant_review_results.html");
                     $this->template->setDisplayData("position_name", I2CE_List::lookup($position_id, "position"));
                     $results = iHRIS_Applicant::findApplicants($position_id);
                     if (count($results) > 0) {
                         foreach ($results as $app_id => $app_data) {
                             $this->template->appendFileById("applicant_review_row.html", "li", "app_list");
                             $this->template->setDisplayData("app_id", array("id" => "person|" . $app_id));
                             $this->template->setDisplayData("app_name", $app_data['surname'] . ', ' . $app_data['firstname']);
                             //$last_mod = I2CE_Date::fromDB( $app_data['last_modified'] );
                             //$this->template->setDisplayData( "app_modified", $last_mod->displayDate() );
                             $this->template->setDisplayData("make_offer", array("parent" => "person|" . $app_id, "position" => $this->get('position')));
                         }
                     } else {
                         $this->template->appendFileById("applicant_review_no_results.html", "li", "app_list");
                     }
                 } else {
                     $this->template->addFile("applicant_review_list.html");
                     $positions = I2CE_Form::listFields("position", array("code", "title"), array('operator' => 'FIELD_LIMIT', 'field' => 'status', 'style' => 'equals', 'data' => array('value' => 'position_status|open')));
                     $count = 0;
                     foreach ($positions as $id => $data) {
                         $node = $this->template->appendFileById("applicant_review_list_entry.html", "tr", "open_position_list");
                         if (++$count % 2 == 0) {
                             $node->setAttribute("class", "even");
                         }
                         $this->template->setDisplayDataImmediate("view_applicant", array("action" => "review", "position" => "position|" . $id), $node);
                         $this->template->setDisplayDataImmediate("position_name", $data['code'] . " - " . $data['title'], $node);
                     }
                 }
             } else {
                 parent::action();
             }
             break;
         default:
             parent::action();
             break;
     }
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:54,代码来源:iHRIS_PageManage.php

示例12: trigger_upload_save

 /**
  * Sends any triggers when participants are uploaded
  * @param I2CE_PageFormCSV $page
  */
 public function trigger_upload_save($page)
 {
     if (!$page instanceof I2CE_PageFormCSV) {
         return;
     }
     $module_factory = I2CE_ModuleFactory::instance();
     if ($module_factory->isEnabled("UserTriggers")) {
         $triggers = $module_factory->getClass("UserTriggers");
         $instance = $page->getProviderInstance();
         $details = I2CE_List::lookup($instance->getId(), $instance->getName());
         $triggers->trigger('participant_upload_save', null, 'Participants were uploaded for ' . $details, true, $instance->getNameId());
     } else {
         I2CE::raiseError("Unable to call trigger because UserTriggers isn't enabled!");
     }
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:19,代码来源:iHRIS_Module_ParticipantUploadTrigger.php

示例13: action_initialize

 /** 
  * Method called before the module is enabled for the first time.
  * @param boolean -- returns true on success. false on error.
  */
 public function action_initialize()
 {
     /*
      * This module was split off from Custom Reports.
      * If Custom Reports has been used previously then we should assume the methods
      * are defined there so they need to be turned off until CustomReports can be
      * upgraded when it is required.
      */
     $cr_vers = null;
     I2CE::getConfig()->setIfIsSet($cr_vers, "/config/data/CustomReports/version");
     if ($cr_vers !== null && I2CE_Validate::checkVersion($cr_vers, '<', '3.2')) {
         I2CE::raiseError("Removing hooks from CustomReports because they were moved to form-limits.");
         I2CE_ModuleFactory::instance()->removeHooks("CustomReports");
     }
     return true;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:20,代码来源:I2CE_Module_FormLimits.php

示例14: migrate

 /**
  * Perform the migrate actions for this module.
  * @return boolean
  */
 protected function migrate()
 {
     $user = new I2CE_User(1, false, false, false);
     $class_config = I2CE::getConfig()->modules->forms->formClasses;
     $migrate_path = "/I2CE/formsData/migrate_data/4.1.8";
     if (!I2CE_FormStorage::migrateForm("training_classification", "entry", $user, $migrate_path)) {
         return false;
     }
     if (I2CE_ModuleFactory::instance()->isEnabled("CachedForms")) {
         $cachedForm = new I2CE_CachedForm("training_classification");
         $cachedForm->dropTable();
     }
     if (!I2CE_FormStorage::migrateField("training", array("training_classification" => "training_classification"), $migrate_path, $user)) {
         return false;
     }
     return true;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:21,代码来源:iHRIS_Module_TrainingClassification.php

示例15: validate_form_person

 /**
  * Perform extra validation for the person form.
  * A new person record needs to verify there aren't any existing 
  * records with the same name.
  * @param I2CE_Form $form
  */
 public function validate_form_person($form)
 {
     $search = array();
     $surname_ignore = false;
     if (isset($form->surname_ignore)) {
         $surname_ignore = $form->surname_ignore;
     }
     if (I2CE_ModuleFactory::instance()->isEnabled('forms-storage') && $form->getId() == '0' && !$surname_ignore && I2CE_Validate::checkString($form->surname) && I2CE_Validate::checkString($form->firstname)) {
         $where = array('operator' => 'AND', 'operand' => array(0 => array('operator' => 'FIELD_LIMIT', 'field' => 'surname', 'style' => 'lowerequals', 'data' => array('value' => strtolower($form->surname))), 1 => array('operator' => 'FIELD_LIMIT', 'field' => 'firstname', 'style' => 'lowerequals', 'data' => array('value' => strtolower($form->firstname)))));
         $results = I2CE_FormStorage::listFields('person', array('surname', 'firstname'), false, $where, array('surname', 'firstname'));
         if (count($results) > 0) {
             foreach ($results as $id => &$data) {
                 $data = implode(', ', $data);
             }
             $form->setInvalidMessage('surname', 'unique', array("view?id=" => $results));
         }
     }
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:24,代码来源:iHRIS_Module_Person.php


注:本文中的I2CE_ModuleFactory::instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。