本文整理汇总了PHP中I2CE_ModuleFactory::callHooks方法的典型用法代码示例。如果您正苦于以下问题:PHP I2CE_ModuleFactory::callHooks方法的具体用法?PHP I2CE_ModuleFactory::callHooks怎么用?PHP I2CE_ModuleFactory::callHooks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类I2CE_ModuleFactory
的用法示例。
在下文中一共展示了I2CE_ModuleFactory::callHooks方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: setupEnum
/**
* Setup list of enumerated values for this field.
*/
public function setupEnum($display = 'default')
{
if (count($this->enum_values) > 0) {
return;
}
$values = array();
if (($enum = $this->getOptionsByPath("meta/enum")) !== null) {
if (array_key_exists('data', $enum)) {
//$values = array_merge( $values, $enum['data'] );
$values += $enum['data'];
}
if (array_key_exists('hook', $enum)) {
$hooks = I2CE_ModuleFactory::callHooks($enum['hook']);
foreach ($hooks as $hook_data) {
//$values = array_merge( $values, $hook_data );
$values += $hook_data;
}
}
if (array_key_exists('method', $enum)) {
if (array_key_exists('static', $enum['method']) || array_key_exists('module', $enum['method'])) {
if (array_key_exists('module', $enum['method'])) {
foreach ($enum['method']['module'] as $module => $method) {
$modObj = I2CE_ModuleFactory::instance()->getClass($module);
if (!$modObj || !method_exists($modObj, $method)) {
I2CE::raiseError("No module found for {$module} when getting enum values or {$method} doesn't exist for " . $this->name);
continue;
}
//$values = array_merge( $values, $modObj->{$method}() );
$values += $modObj->{$method}();
}
}
if (array_key_exists('static', $enum['method'])) {
foreach ($enum['method']['static'] as $class => $method) {
if (!class_exists($class) || !method_exists($class, $method)) {
I2CE::raiseError("Couldn't find class {$class} or method {$method} in class for enum values.");
continue;
}
//$values = array_merge( $values, call_user_func( array( $class, $method ) ) );
$values += call_user_func(array($class, $method));
}
}
} else {
I2CE::raiseError("No valid arguments for call in ENUM for " . $this->name);
}
}
if (array_key_exists('sort', $enum)) {
if ($enum['sort'] == "key") {
ksort($values);
} elseif ($enum['sort'] == "value") {
asort($values);
}
} else {
// Default sort by values
asort($values);
}
} else {
I2CE::raiseError("No enum setting for " . $this->name);
}
$this->enum_values = $values;
}
示例3: __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');
}
示例4: 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);
}
}
示例5: appendChildTemplate
public function appendChildTemplate($form, $set_on_node = null, $template = false, $tag = 'div', $appendNode = null)
{
end($this->parentObjs);
if (!($parentObject = current($this->parentObjs)) instanceof I2CE_Form) {
I2CE::raiseError("Unexpected object");
return false;
}
$auto_template = array_key_exists('children', $this->args) && is_array($this->args['children']) && array_key_exists($form, $this->args['children']) && is_array($this->args['children'][$form]) && array_key_exists('auto_template', $this->args['children'][$form]) && is_array($this->args['children'][$form]['auto_template']) && !(array_key_exists('disabled', $this->args['children'][$form]['auto_template']) && $this->args['children'][$form]['auto_template']['disabled']);
if (!$auto_template) {
if (!array_key_exists($form, $parentObject->children) || !is_array($parentObject->children[$form])) {
return true;
}
$child_forms = $parentObject->children[$form];
} else {
if (!array_key_exists($form, $parentObject->children) || !is_array($parentObject->children[$form])) {
$child_forms = array(I2CE_FormFactory::instance()->createContainer($form));
} else {
$child_forms = $parentObject->children[$form];
}
}
if ($appendNode === null) {
$appendNode = $form;
}
if (is_string($appendNode)) {
$appendNode = $this->template->getElementById($appendNode);
}
if (!$appendNode instanceof DOMNode) {
I2CE::raiseError("Do not know where to add child form {$form} ");
return false;
}
foreach ($child_forms as $formObj) {
if ($formObj instanceof I2CE_Form) {
I2CE_ModuleFactory::callHooks('pre_add_child_form_' . $form, array('form' => $formObj, 'page' => $this, 'set_on_node' => $set_on_node, 'append_node' => $appendNode));
}
if (!$auto_template) {
if (!$formObj instanceof I2CE_Form) {
continue;
}
if (!is_string($template) || !$template) {
$template = $this->getChildTemplate($form);
}
$node = $this->template->appendFileByNode($template, $tag, $appendNode);
} else {
$node = $this->generateAutoChildTemplate($formObj, $this->args['children'][$form]['auto_template'], $appendNode);
}
if (!$node instanceof DOMNode) {
I2CE::raiseError("Could not find template {$template} for child form {$form} of " . $parentObject->getName());
return false;
}
if ($formObj instanceof I2CE_Form) {
$this->template->setForm($formObj, $node);
if ($set_on_node !== null) {
$this->template->setForm($formObj, $set_on_node);
}
I2CE_ModuleFactory::callHooks('post_add_child_form_' . $form, array('form' => $formObj, 'node' => $node, 'page' => $this, 'set_on_node' => $set_on_node, 'append_node' => $appendNode));
if (!$this->action_children($formObj, $node)) {
I2CE::raiseError("Couldn't display child " . $form);
}
}
}
return $appendNode;
}
示例6: save
/**
* Save the objects to the database.
*
* Save the default object being edited
* Most saving will be handled by the processRow functions.
* @global array
*/
protected function save()
{
foreach (array_keys($this->files) as $key) {
if (!$this->processHeaderRow($key)) {
return false;
}
while ($this->processRow($key)) {
if (!$this->saveRow($key)) {
return false;
}
}
}
I2CE_ModuleFactory::callHooks('post_save_csv_upload_' . $this->module . '_page_' . $this->page, $this);
return true;
}
示例7: validate
/**
* Validate all fields that are marked as required or unique.
*
* This will check all the fields in this form and if they're required or unique it
* will perform the required checks
*/
public function validate()
{
I2CE_ModuleFactory::callHooks("validate_form", $this);
I2CE_ModuleFactory::callHooks("validate_form_" . $this->getName(), $this);
foreach ($this->fields as $field_name => $field_obj) {
I2CE_ModuleFactory::callHooks("validate_formfield", $field_obj);
I2CE_ModuleFactory::callHooks("validate_form_" . $this->getName() . "_field_" . $field_name, $field_obj);
}
}
示例8: listOptions
public static function listOptions($form_name, $show_hidden = 0, $select_fields = array())
{
$where = array();
if (!is_array($select_fields)) {
$select_fields = array($select_fields);
}
foreach ($select_fields as $select_field) {
if (!$select_field instanceof I2CE_FormField_MAPPED || !$select_field->isSetValue() || !$select_field->isValid() || !($select_form = $select_field->getContainer()) instanceof I2CE_Form || $select_form->getName() != $form_name) {
continue;
}
$where[] = array('operator' => 'FIELD_LIMIT', 'field' => $select_field->getName(), 'style' => 'equals', 'data' => array('value' => $select_field->getDBValue()));
}
$add_limits = array();
foreach (I2CE_ModuleFactory::callHooks("get_limit_add_form_{$form_name}_id") as $add_limit) {
if (!is_array($add_limit) || !array_key_exists($form_name, $add_limit) || !is_array($add_limit[$form_name])) {
continue;
}
$add_limits[] = $add_limit;
}
$where = array_merge($where, $add_limits);
if (count($where) > 0) {
$where = array('operator' => 'AND', 'operand' => $where);
}
$forms = array($form_name);
$limits = array($form_name => $where);
$limits = array($form_name => $where);
$orders = array($form_name => self::getSortFields($form_name));
$fields = array($form_name);
$data = I2CE_DataTree::buildDataTree($fields, $forms, $limits, $orders, $show_hidden);
$data = I2CE_DataTree::flattenDataTree($data);
return $data;
}
示例9: actionMenu
protected function actionMenu()
{
I2CE_ModuleFactory::callHooks('pre_admin_menu_modules', array('page' => $this));
$this->template->setBodyId("adminPage");
$config = I2CE::getConfig()->config;
$this->template->setAttribute("class", "active", "menuConfigure", "a[@href='configure']");
$this->template->appendFileById("menu_configure.html", "ul", "menuConfigure");
$this->template->setAttribute("class", "active", "menuConfigureModules", "a[@href='admin/modules']");
if ($this->isGet() && $this->get_exists('redirect') && $this->get('redirect')) {
$this->template->setDisplayData("redirect", $this->get('redirect'));
}
$siteModule = '';
$this->mod_factory->checkForNewModules();
//re-read all the module information available to the system
$config->setIfIsSet($siteModule, 'site/module');
//now we get the sub-modules of the current module
if ($this->isGet() && $this->get_exists('possibles')) {
$modules = explode(':', $this->get('possibles'));
} else {
if ($this->shortname == 'I2CE') {
$modules = array();
if ($siteModule) {
$modules = $this->mod_factory->checkForNewModules($siteModule);
}
$t_modules = $this->mod_factory->checkForNewModules('I2CE');
foreach ($t_modules as $module) {
if (!in_array($module, $modules)) {
$modules[] = $module;
}
}
} else {
$modules = $this->mod_factory->checkForNewModules($this->shortname);
}
}
$this->template->addHeaderLink("admin.css");
$this->template->addHeaderLink("mootools-core.js");
$this->template->addHeaderLink("admin.js");
$cats = array();
foreach ($modules as $module) {
$dispName = $config->data->{$module}->displayName;
if ($dispName != 'I2CE') {
$dispName = preg_replace('/^I2CE\\s+/', '', $dispName);
}
if (isset($config->data->{$module}->category)) {
$cats[$config->data->{$module}->category][$module] = $dispName;
} else {
$cats['UNCATEGORIZED'][$module] = $dispName;
}
}
ksort($cats);
$compare = create_function('$m,$n', 'return strcasecmp($m,$n);');
foreach ($cats as $cat => $modules) {
uasort($modules, $compare);
$cats[$cat] = $modules;
}
$menuNode = $this->template->addFile("module_menu.html", "div");
$displayData = array('module_link' => 'link', 'module_description' => 'description', 'module_email' => 'email', 'module_email_2' => 'email', 'module_version' => 'version', 'module_creator' => 'creator', 'module_name' => 'displayName');
$possibles = array();
$configurator = new I2CE_Configurator(I2CE::getConfig());
foreach ($cats as $cat => $modList) {
$catNode = $this->template->appendFileById("module_category.html", "div", "modules");
if (!$catNode instanceof DOMNode) {
continue;
}
if ($cat != 'UNCATEGORIZED') {
$this->template->setDisplayData("module_category", $cat, $catNode);
} else {
$this->template->setDisplayData("module_category", 'Uncategorized', $catNode);
}
foreach ($modList as $module => $displayName) {
$conflicting = false;
$modNode = $this->template->appendFileByName("module_module.html", "li", "module_list", 0, $catNode);
if (!$modNode instanceof DOMNode) {
continue;
}
$modNode->setAttribute('id', 'tr_' . $module);
$modNode->setAttribute('name', $module);
$data = $config->data->{$module};
$origEnableNode = $this->template->getElementByName('module_enable', 0);
if ($module == 'I2CE') {
$origEnableNode->parentNode->removeChild($origEnableNode);
} else {
if ($module == $config->site->module) {
$origEnableNode->parentNode->removeChild($origEnableNode);
} else {
$reqs = $configurator->getDependencyList($module);
$badness = '';
$origEnableNode->setAttribute('id', $module);
if (array_key_exists('badness', $reqs) && !empty($reqs['badness'])) {
$badness = $reqs['badness'];
if ($this->mod_factory->isEnabled($module)) {
$checked = "checked='checked' disabled='disabled'";
//shouldn't be
} else {
$checked = ' disabled="disabled"';
}
$conflicting = true;
$modNode->setAttribute('class', 'conflict');
$deps = implode(',', $reqs['requirements']);
$optional = implode(',', $reqs['enable']);
//.........这里部分代码省略.........
示例10: _display
/**
* Display the template as HTML/XML. Sets the header and displays any buffered warnings/echoed text.
*/
protected function _display($supress_output)
{
if (!$supress_output && array_key_exists('HTTP_HOST', $_SERVER)) {
$headers = $this->template->getHeaders();
if (!is_array($headers)) {
$headers = array($headers);
}
foreach ($headers as $header) {
header($header);
}
}
$classes = array();
if ($this->template instanceof I2CE_TemplateMeister) {
$class = get_class($this->template);
while ($class && $class != 'I2CE_Fuzzy') {
$classes[] = $class;
$class = get_parent_class($class);
}
$num = count($classes);
}
I2CE_ModuleFactory::callHooks('pre_page_prepare_display', $this);
for ($i = $num - 1; $i >= 0; $i--) {
I2CE_ModuleFactory::callHooks('pre_page_prepare_display_' . $classes[$i], $this);
}
if ($this->template instanceof I2CE_TemplateMeister) {
$this->template->prepareDisplay();
}
for ($i = $num - 1; $i >= 0; $i--) {
I2CE_ModuleFactory::callHooks('post_page_prepare_display_' . $classes[$i], $this);
}
I2CE_ModuleFactory::callHooks('post_page_prepare_display', $this);
if ($this->template instanceof I2CE_Template) {
$this->template->checkRolesTasksAndPermissions();
}
I2CE_ModuleFactory::callHooks('final_page_prepare_display', $this);
if (!$supress_output) {
$display = '';
if ($this->template instanceof I2CE_TemplateMeister) {
$display = $this->template->getDisplay();
}
$buffer = '';
if (ob_get_level() == I2CE::$ob_level + 1) {
$buffer = ob_get_clean();
}
echo $display;
flush();
if ($buffer) {
I2CE::raiseError("The page " . $_SERVER['PHP_SELF'] . " has errors");
$buffer = str_replace(array('<br/>', '<br />'), "\n", $buffer);
$buffer = htmlentities($buffer, ENT_COMPAT, 'UTF-8', false);
echo "<span class='buffered_errors'><pre>{$buffer}</pre></span>";
}
}
}
示例11: actionRecent
/**
* Display the recent changes list for the given form.
* @return boolean
*/
protected function actionRecent()
{
$form = array_shift($this->request_remainder);
$form_config = I2CE::getConfig()->traverse("/modules/forms/forms");
if (!$form_config->is_parent($form) || !I2CE::getConfig()->is_parent("/modules/RecentForm/forms/{$form}")) {
return $this->actionMenu();
}
$page_size = 25;
$days = "today";
$user = false;
if (count($this->request_remainder) > 0) {
$days = array_shift($this->request_remainder);
}
$user_list = false;
if (count($this->request_remainder) > 0) {
$user_list = array_shift($this->request_remainder);
$user = explode(',', $user_list);
foreach ($user as $key => $uid) {
if ($uid == "me") {
$uobj = new I2CE_User();
$user[$key] = $uobj->getId();
}
}
$user = array_filter($user, "is_numeric");
if (count($user) == 0) {
$user = false;
} elseif (count($user) == 1) {
$user = array_pop($user);
}
}
switch ($days) {
case "yesterday":
$mod_time = mktime(0, 0, 0, date("n"), date("j") - 1);
break;
case "week":
$mod_time = mktime(0, 0, 0, date("n"), date("j") - 7);
break;
default:
$mod_time = mktime(0, 0, 0);
break;
}
$form_name = $form;
$form_config->setIfIsSet($form_name, "{$form}/display");
$user_link = "";
if ($user_list) {
$user_link = "/" . $user_list;
}
$this->template->setDisplayDataImmediate("display_form_name", ": " . $form_name);
$header = $this->template->appendFileById("recent_display.html", "div", "recent_forms");
$this->template->setDisplayDataImmediate("recent_name", $form_name, $header);
$this->template->setDisplayDataImmediate("recent_date", date("d M Y", $mod_time), $header);
$this->template->setDisplayDataImmediate("recent_today_link", array("href" => "recent/{$form}/today" . $user_link), $header);
$this->template->setDisplayDataImmediate("recent_yesterday_link", array("href" => "recent/{$form}/yesterday" . $user_link), $header);
$this->template->setDisplayDataImmediate("recent_week_link", array("href" => "recent/{$form}/week" . $user_link), $header);
$this->template->setDisplayDataImmediate("recent_me_link", array("href" => "recent/{$form}/{$days}/me"), $header);
$this->template->setDisplayDataImmediate("recent_all_link", array("href" => "recent/{$form}/{$days}"), $header);
$recent_form_config = I2CE::getConfig()->traverse("/modules/RecentForm/forms/{$form}", true);
$fields = $recent_form_config->fields->getAsArray();
ksort($fields);
if (!is_array($fields)) {
$fields = array();
}
$display = implode(" ", array_fill(0, count($fields), "%s"));
$recent_form_config->setIfIsSet($display, "display");
$link = "recent";
$recent_form_config->setIfIsSet($link, "link");
$parent = false;
$recent_form_config->setIfIsSet($parent, "parent");
if ($parent) {
$parent = true;
}
$order = $fields;
array_unshift($order, "-last_modified");
if ($this->request_exists("page")) {
$limit_start = ((int) $this->request("page") - 1) * $page_size;
} else {
$limit_start = 0;
}
$results = I2CE_FormStorage::listDisplayFields($form, $fields, $parent, array(), $order, array($limit_start, $page_size), $mod_time, false, $user);
$num_found = I2CE_FormStorage::getLastListCount($form);
$this->template->setDisplayDataImmediate("recent_found", $num_found, $header);
foreach ($results as $id => $data) {
$record = $this->template->appendFileById("recent_display_form.html", "li", "recent_list");
if ($parent) {
$this->template->setDisplayDataImmediate("form_link", array("href" => $link . $data['parent']), $record);
} else {
$this->template->setDisplayDataImmediate("form_link", array("href" => $link . $form . "|" . $id), $record);
}
$extra_display = I2CE_ModuleFactory::callHooks("recent_form_{$form}_display", $data);
array_unshift($extra_display, vsprintf($display, $data));
$this->template->setDisplayDataImmediate("record_display", implode(' ', $extra_display), $record);
}
if ($this->module == "I2CE") {
$url = $this->page . "/" . $form . "/" . $days;
} else {
$url = $this->module . "/" . $this->page . "/" . $form . "/" . $days;
//.........这里部分代码省略.........
示例12: ensureModuleLimits
/**
* Make sure all the appropriate module limits are available.
*/
protected function ensureModuleLimits()
{
if ($this->ensured) {
return;
}
if ($this->storage->is_scalar()) {
return false;
}
if (!$this->parent instanceof I2CE_Swiss_CustomReports_Report_ReportingForm_Field) {
return false;
}
if (($fieldObj = $this->parent->getFieldObj()) instanceof I2CE_FormField) {
I2CE::raiseError("Calling get_report_module_limit_options on " . $fieldObj->getHTMLName());
$limits = I2CE_ModuleFactory::callHooks("get_report_module_limit_options");
I2CE::raiseError("get_report_module_limit_options returns" . print_r($limits, true));
foreach ($limits as $limit) {
if (!is_array($limit) || !array_key_exists('fields', $limit) || !is_array($limit['fields'])) {
continue;
}
if ($fieldObj->getName() == 'id' && ($formObj = $fieldObj->getContainer()) instanceof I2CE_Form && array_key_exists($form = $formObj->getName(), $limit['fields'])) {
$limit['fields'] = array($form => $limit['fields'][$form]);
} elseif ($fieldObj instanceof I2CE_FormField_MAPPED && count($field_forms = $fieldObj->getSelectableForms()) == 1) {
//check to see if the fields mapped value can be one of the selectable form
I2CE::raiseError("Have a mapped Field with selectable forms:\n\t" . implode(" ", $field_forms) . "\ncomapring against access_facility+location selectable:\n\t" . implode(" ", array_keys($limit['fields'])));
foreach ($limit['fields'] as $form => $formName) {
if (!in_array($form, $field_forms)) {
unset($limit['fields'][$form]);
}
}
} else {
$limit['fields'] = array();
}
if (count($limit['fields']) == 0) {
continue;
}
$swissModuleLimit = $this->getChild($limit['module'], true);
if (!$swissModuleLimit instanceof I2CE_Swiss_CustomReports_Report_ReportingForm_Field_ModuleLimit) {
I2CE::raiseError("Bad swiss child for " . $limit['module']);
}
$swissModuleLimit->setFieldOptions($limit['fields']);
$this->allowed[] = $limit['module'];
}
}
$this->ensured = true;
}
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:48,代码来源:I2CE_Swiss_CustomReports_Report_ReportingForm_Field_ModuleLimits.php
示例13: setPreferredLocales
/**
* Validates and sets the preferred locales for the session
* in order of decreasing preference. It makes sure that self::DEFAULT_LOCALE is in the list
* of preferred locales.
* @param mixed @locales. string or array of string. The preferred locale or an array of prefered locales.
* @returns array of string, the locales that were set.
*/
protected static function setPreferredLocales($locales)
{
$old_locales = self::getPreferredLocales();
$changed = false;
if (!array_key_exists('preferred_locales', $_SESSION) || !is_array($_SESSION['preferred_locales'])) {
$changed = true;
} else {
if (count($_SESSION['preferred_locales']) != count($locales)) {
$changed = true;
} else {
foreach ($locales as $i => $locale) {
if ($locale != $_SESSION['preferred_locales'][$i]) {
$changed = true;
break;
}
}
}
}
I2CE::getConfig()->setLocales($locales);
if ($changed) {
$_SESSION['preferred_locales'] = $locales;
I2CE_ModuleFactory::callHooks('locales_changed', array('old_locales' => $old_locales, 'locales' => $locales));
}
return $_SESSION['preferred_locales'];
}
示例14: cleanup
/**
* Clean up all the fields for this form.
*
* This will unset all the fields associated with this form. This will remove
* all circular references to this form so it can be cleaned up by the garbage collector.
* This should only be called when the form is no longer needed. Trying to access it
* after this may cause unexpected results or errors.
*/
public function cleanup($remove_from_cache = true)
{
if ($this->parentField instanceof I2CE_FormField) {
$this->parentField->cleanup();
}
unset($this->parentField);
if ($this->lastModifiedField instanceof I2CE_FormField) {
$this->lastModifiedField->cleanup();
}
if ($this->createdField instanceof I2CE_FormField) {
$this->createdField->cleanup();
}
unset($this->lastModifiedField);
unset($this->createdField);
I2CE_ModuleFactory::callHooks('form_cleanup', array('form' => $this, 'remove_from_cache' => $remove_from_cache));
parent::cleanup($remove_from_cache);
}
示例15: action
/**
* Perform the actions of the page.
*/
protected function action()
{
$can_see = false;
if ($this->hasPermission('task(users_can_edit_all)')) {
$can_see = true;
} elseif ($this->hasPermission('task(users_can_edit)')) {
$userAccess = I2CE::getUserAccess();
if ($userAccess instanceof I2CE_UserAccess_Mechansim && in_array('creator', $userAccess->getAllowedDetails()) && $this->view_user->creator == $this->user->id) {
$can_see = true;
}
}
if (!$can_see) {
$this->userMessage("You can not edit this user.", 'notice', false);
$this->setRedirect("user");
return false;
}
I2CE_ModuleFactory::callHooks("pre_page_view_user", $this);
parent::action();
$this->template->setForm($this->view_user);
$child_forms = $this->view_user->getChildForms();
foreach ($child_forms as $child) {
$method = "action_" . $child;
if ($this->_hasMethod($method)) {
if (!$this->{$method}()) {
I2CE::raiseError("Could not do action for {$form}.");
}
}
}
I2CE_ModuleFactory::callHooks("post_page_view_user", $this);
return true;
}