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


PHP I2CE_ModuleFactory类代码示例

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


在下文中一共展示了I2CE_ModuleFactory类的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: 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

示例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 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

示例5: handleMessages

 public function handleMessages($page)
 {
     $template = $page->getTemplate();
     if (!is_array($this->immediate_messages)) {
         $this->immediate_messages = array();
     }
     if (!array_key_exists('user_messages', $_SESSION) || !is_array($_SESSION['user_messages'])) {
         $_SESSION['user_messages'] = array();
     }
     if (!array_key_exists('current', $_SESSION['user_messages']) || !is_array($_SESSION['user_messages']['current'])) {
         $_SESSION['user_messages']['current'] = array();
     }
     foreach ($_SESSION['user_messages']['current'] as $class => $msgs) {
         if (!array_key_exists($class, $this->immediate_messages)) {
             $this->immediate_messages[$class] = array();
         }
         $this->immediate_messages[$class] = array_merge($this->immediate_messages[$class], $msgs);
     }
     foreach ($this->immediate_messages as $class => $msgs) {
         $msgs = array_unique($msgs);
         I2CE_ModuleFactory::callHooks("display_messages_{$class}", array('template' => $template, 'messages' => $msgs));
     }
     $this->immediate_messages = array();
     $_SESSION['user_messages']['current'] = array();
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:25,代码来源:I2CE_MessageHandler.php

示例6: 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

示例7: __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

示例8: __construct

 public function __construct()
 {
     I2CE_ModuleFactory::callHooks('formfactory_pre_construct');
     $this->classes = I2CE::getConfig()->modules->forms->forms;
     $this->classHierarchy = array();
     parent::__construct();
     I2CE_ModuleFactory::callHooks('formfactory_post_construct');
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:8,代码来源:I2CE_FormFactory.php

示例9: 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

示例10: __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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: 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


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