• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP I2CE_ModuleFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了I2CE_ModuleFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: closePosition

 /**
  * Mark this position as closed and remove it from any applications.
  * 
  * The person being assigned the position will have all application positions removed.
  * @param I2CE_User &$user The user performing this action.
  * @param integer $person_id The person being assigned this position.
  */
 public function closePosition(&$user, $person_id)
 {
     $factory = I2CE_FormFactory::instance();
     $this->setStatus("position_status|closed");
     $this->save($user);
     $mod_factory = I2CE_ModuleFactory::instance();
     if ($mod_factory->isEnabled('ihris-manage-Application')) {
         $apps = iHRIS_Applicant::findApplications($this->id);
         if (count($apps) > 0) {
             foreach ($apps as $app_id => $data) {
                 $app = $factory->createContainer("application|" . $app_id);
                 $app->populate();
                 $app->removePosition($this->getNameId());
                 $app->save($user);
             }
         }
     }
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:25,代码来源:iHRIS_Position.php


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


示例18: displayModules

 protected function displayModules($contentNode)
 {
     if (!$contentNode instanceof DOMNode) {
         I2CE::raiseError("Nowhere to display content");
         return false;
     }
     $mod_factory = I2CE_ModuleFactory::instance();
     $modules = $mod_factory->getAvailable();
     foreach ($modules as $module) {
         if (!$mod_factory->isInitialized($module)) {
             continue;
         }
         if (!$mod_factory->hasConfigData($module)) {
             continue;
         }
         $contentNode->appendChild($this->template->createElement('a', array('href' => $this->module() . '/edit/' . $module), 'Edit ' . $module));
         $contentNode->appendChild($this->template->createElement('a', array('href' => $this->module() . '/view/' . $module), 'view ' . $module));
         $contentNode->appendChild($this->template->createElement('br'));
     }
     return true;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:21,代码来源:I2CE_Page_SwissConfig.php


示例19: validate_form_trainingprovider

 /**
  * Perform extra validation for the trainingprovider form.
  * A new trainingprovider record needs to verify there aren't any existing 
  * records with the same name.
  * @param I2CE_Form $form
  */
 public function validate_form_trainingprovider($form)
 {
     $search = array();
     $name_ignore = false;
     if (isset($form->name_ignore)) {
         $name_ignore = $form->name_ignore;
     }
     if (I2CE_ModuleFactory::instance()->isEnabled('forms-storage') && $form->getId() == 0 && !$name_ignore && I2CE_Validate::checkString($form->name)) {
         $where = array('operator' => 'AND', 'operand' => array(0 => array('operator' => 'FIELD_LIMIT', 'field' => 'name', 'style' => 'lowerequals', 'data' => array('value' => strtolower($form->name)))));
         $results = I2CE_FormStorage::listFields('trainingprovider', array('name'), false, $where, array('name'));
         if (count($results) > 0) {
             foreach ($results as $id => &$data) {
                 $data = implode(', ', $data);
             }
             $form->getField('name')->setInvalid("Duplicate records match this record's name:", array("viewprovider?id=" => $results));
         }
     }
     $value = $form->getField('email')->getValue();
     if (I2CE_Validate::checkString($value) && !I2CE_Validate::checkEmail($value)) {
         $form->getField('email')->setInvalid('invalid_email');
     }
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:28,代码来源:iHRIS_Module_TrainingProvider.php


示例20: i2ce_class_autoload

/**
 * The autoload function is used to load class files when needed
 * 
 * This function will be used to load any class files when they
 * are required instead of in every file.
 * 
 * It searchs the configuration array for the common class directory
 * as well as the class directory specifically for this project.
 * @global array
 * @param string $class_name The name of the class being loaded
 */
function i2ce_class_autoload($class_name)
{
    $class_file = I2CE::getfileSearch()->search('CLASSES', $class_name . '.php');
    $class_found = false;
    if ($class_file) {
        require_once $class_file;
        if (class_exists($class_name, false) || interface_exists($class_name, false)) {
            $class_found = true;
        } else {
            I2CE::raiseError("Defintion for class {$class_name} is not contained in {$class_file}", E_USER_WARNING);
        }
    }
    if (!$class_found) {
        $classes = I2CE_ModuleFactory::callHooks('autoload_search_for_class', $class_name);
        $count = count($classes);
        foreach ($classes as $class) {
            if (!is_string($class) || strlen($class) == 0) {
                continue;
            }
            if (false === eval($class)) {
                I2CE::raiseError("While looking for {$class_name}, could not parse: {$class}");
            }
            if (class_exists($class_name, false)) {
                $class_found = true;
                break;
            }
        }
    }
    if (!$class_found) {
        $debug = debug_backtrace();
        $msg = "Cannot find the defintion for class ({$class_name})";
        if (array_key_exists(1, $debug) && array_key_exists('line', $debug[1])) {
            $msg .= "called from  line " . $debug[1]['line'] . ' of file ' . $debug[1]['file'];
        }
        $msg .= "\nSearch Path is:\n" . print_r(I2CE::getFileSearch()->getSearchPath('CLASSES'), true);
        //        I2CE::raiseError( $msg, E_USER_NOTICE);
    }
}
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:49,代码来源:I2CE_config.inc.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ICE_Loader类代码示例发布时间:2022-05-23
下一篇:
PHP I2CE_FormStorage类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap