本文整理汇总了PHP中I2CE::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP I2CE::getConfig方法的具体用法?PHP I2CE::getConfig怎么用?PHP I2CE::getConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类I2CE
的用法示例。
在下文中一共展示了I2CE::getConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayValues
public function displayValues($content_node, $transient_options, $action)
{
if (!($mainNode = $this->template->appendFileByNode('swiss_form_meta.html', 'div', $content_node)) instanceof DOMNode) {
I2CE::raiseError("no template ");
return false;
}
$inputs = array('description');
$forms = I2CE::getConfig()->getKeys("/modules/forms/forms");
$selected = $this->getSelectedForms();
if (!is_array($selected)) {
//in case it wan't ever set
$selected = array();
}
if (($formsNode = $this->template->getElementByName('child_forms', 0, $mainNode)) instanceof DOMNode) {
foreach ($forms as $form) {
$input = 'child_forms[' . $form . ']';
$inputs[] = $input;
$attr = array('value' => 1, 'name' => $input, 'type' => 'checkbox');
if (in_array($form, $selected)) {
$attr['checked'] = 'checked';
}
$formsNode->appendChild($formNode = $this->template->createElement('span', array('style' => 'display:inline-block;width:33%; min-width:33%')));
$formNode->appendChild($this->template->createElement('input', $attr));
$formNode->appendChild($this->template->createTextNode($form));
}
}
$this->template->setDisplayDataImmediate('description', $this->getField('description'), $mainNode);
$this->renameInputs($inputs, $mainNode);
if (($swissChild = $this->getChild('child_form_data', true)) instanceof I2CE_Swiss && ($childNode = $this->template->getElementById('child_form_data', $mainNode)) instanceof DOMNode) {
$swissChild->addAjaxLink('child_form_data_link', 'display_container', 'child_form_data_ajax', $childNode, $action, $transient_options);
}
return true;
}
示例2: javascriptTimeout
/**
* 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);
}
}
示例3: displayValues
public function displayValues($content_node, $transient_options, $action)
{
if (!($mainNode = $this->template->appendFileByNode('swiss_form.html', 'div', $content_node)) instanceof DOMNode) {
I2CE::raiseError("no template form_class_builder_menu.html");
return false;
}
if (($classNode = $this->template->getElementByName('class', 0, $mainNode)) instanceof DOMNode) {
$selected = $this->getField('class');
foreach (I2CE::getConfig()->getKeys("/modules/forms/formClasses") as $class) {
$attrs = array('value' => $class);
if ($selected == $class) {
$attrs['selected'] = $selected;
}
$classNode->appendChild($this->template->createElement('option', $attrs, $class));
}
}
$this->template->setDisplayDataImmediate('display', $this->getField('display'), $mainNode);
$storage = $this->getField('storage');
if (!$storage) {
$storage = 'entry';
}
$this->template->setDisplayDataImmediate('storage', $storage, $mainNode);
$this->renameInputs(array('display', 'class'), $mainNode);
if (($metaChild = $this->getChild('meta', true)) instanceof I2CE_Swiss && ($metaNode = $this->template->getElementById('meta', $mainNode)) instanceof DOMNode) {
$metaChild->addAjaxLink('meta_link', 'container', 'meta_ajax', $metaNode, $action, $transient_options);
}
if (($storage_optionsChild = $this->getChild('storage_options', true)) instanceof I2CE_Swiss && ($storage_optionsNode = $this->template->getElementById('storage_options', $mainNode)) instanceof DOMNode) {
$storage_optionsChild->addAjaxLink('storage_options_link', 'container', 'storage_options_ajax', $storage_optionsNode, $action, $transient_options);
}
return true;
}
示例4: upgrade
/**
* Upgrade this module if necessary
* @param string $old_vers
* @param string $new_vers
* @return boolean
*/
public function upgrade($old_vers, $new_vers)
{
/*
* In 3.2.3 we moved some lists from entry to magicdata storage so we need to get the
* old data from entry and save them to the new form storage.
*/
if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.3')) {
$user = new I2CE_User(1, false, false, false);
$class_config = I2CE::getConfig()->modules->forms->formClasses;
$migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
if (!I2CE_FormStorage::migrateField("training_course_competency_evaluation", array("competency_evaluation" => "competency_evaluation", "competency" => "competency"), $migrate_path, $user)) {
return false;
}
if (!I2CE_FormStorage::migrateField("training_course", array("competency" => "competency"), $migrate_path, $user)) {
return false;
}
// If everything migrated correctly, then remove the unused fields.
unset($class_config->iHRIS_Training_Course_Competency_Evaluation->fields->competency_type);
}
if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.6')) {
$evals = array('not_evaluated' => 'Not Evaluated');
if (!I2CE_Module_Lists::remapFields('competency_evaluation', $evals, 'training_course_competency_evaluation')) {
return false;
}
}
if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.7')) {
// if (!I2CE_Module_Lists::deleteMappedValues('training_course_evaluation', $evals)) {
// return false;
// }
}
return parent::upgrade($old_vers, $new_vers);
}
示例5: loadMimeTypes
/**
* Loads in the file containing mime types and extensions
*/
protected static function loadMimeTypes()
{
self::$extToMimeTypes = array();
$mime_file = null;
if (I2CE::getConfig()->setIfIsSet($mime_file, "/modules/MimeTypes/mime_types")) {
$mime_file = I2CE::getFileSearch()->search('MIME', $mime_file);
}
if (empty($mime_file)) {
I2CE::raiseError('Unable to find mime.types file.', E_USER_WARNING);
return;
}
$a = file($mime_file);
if (empty($a)) {
I2CE::raiseError('mime.types file is empty.', E_USER_WARNING);
return;
}
foreach ($a as $l) {
$l = trim($l);
if (strlen($l) < 1 || $l[0] == '#') {
//skip comments
continue;
}
$pieces = preg_split("/\\s+/", $l, -1, PREG_SPLIT_NO_EMPTY);
if (empty($pieces)) {
//a blank line
continue;
}
$mime = strtolower(array_shift($pieces));
foreach ($pieces as $ext) {
self::$extToMimeTypes[strtolower($ext)] = $mime;
}
}
}
示例6: upgrade
/**
* Upgrades the modules
* @param string $old_vers
* @param string $new_vers
* @returns boolean
*/
public function upgrade($old_vers, $new_vers)
{
if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.12')) {
I2CE::raiseError("Changing contact child forms of training_institution to training_institution_contact");
if (!iHRIS_Module_Contact::changeContactForm('training_institution', 'contact_type|facility', 'training_institution_contact', true)) {
I2CE::raiseError("Could not upgrade training instituion contacts");
return false;
}
}
if (I2CE_Validate::checkVersion($old_vers, '=', '3.2.12')) {
//the changeContactForm did not remvoe the contact form before
if (!iHRIS_Module_Contact::removeContactForm('training_institution')) {
return false;
}
}
if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.19')) {
I2CE::raiseError("Changing contact child forms of training_funder to training_funder_contact");
if (!iHRIS_Module_Contact::changeContactForm('training_funder', 'contact_type|facility', 'training_funder_contact', true)) {
I2CE::raiseError("Could not upgrade training funder contacts");
return false;
}
}
if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.20')) {
$user = new I2CE_User(1, false, false, false);
$class_config = I2CE::getConfig()->modules->forms->formClasses;
$migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
if (!I2CE_FormStorage::migrateField("training_institution", array("location" => array("county" => "county", "district" => "district", "country" => "country")), $migrate_path, $user)) {
return false;
}
if (!I2CE_FormStorage::migrateField("training_funder", array("location" => array("county" => "county", "district" => "district", "country" => "country")), $migrate_path, $user)) {
return false;
}
}
return true;
}
示例7: initMailer
protected static function initMailer()
{
$backend = "mail";
I2CE::getConfig()->setIfIsSet($backend, "/modules/Mailer/mail_server_backend");
I2CE::getConfig()->setIfIsSet(self::$params, "/modules/Mailer/mail_server_params", true);
I2CE::getConfig()->setIfIsSet(self::$headers, "/modules/Mailer/mail_message_headers", true);
if (class_exists('Mail', false)) {
self::$method = 'pear';
$allowed_backends = array("mail", "smtp", "sendmail");
} else {
I2CE::raiseError("No Mail class : try 'sudo apt-get install pear-mail'");
self::$method = 'localhost';
$allowed_backends = array("localhost");
}
if (!in_array($backend, $allowed_backends)) {
I2CE::raiseError("Mailing backend {$backend} is not in list: " . implode(" ", $allowed_backends));
self::$method = false;
return false;
}
if (self::$method == 'pear') {
if (array_key_exists('auth', self::$params) && self::$params['auth'] == 1) {
self::$params['auth'] = true;
}
try {
self::$pear_mailer =& Mail::factory($backend, self::$params);
} catch (Exception $e) {
I2CE::raiseError("Could not create pear mailer:\n" . $e->getMessage());
self::$method = false;
return false;
}
}
}
示例8: processDOMEditable
public function processDOMEditable($node, $template, $form_node)
{
$default = $this->getValue();
$ele_name = $this->getHTMLName();
if (!$default instanceof I2CE_Date) {
$default = I2CE_Date::now();
}
if ($this->use_date_picker) {
$date = $default->dbFormat();
$attrs = array("class" => "datepicker_ymd", "name" => $ele_name, "type" => "text", "value" => $date);
foreach (array('onclick', 'onchange') as $attr) {
if ($node->hasAttribute($attr)) {
$attrs[$attr] = $node->getAttribute($attr);
$node->removeAttribute($attr);
}
}
$element = $template->createElement("input", $attrs);
$this->setElement($element);
$node->appendChild($element);
$args = array('format' => 'F j, Y', 'inputOutputFormat' => 'Y-m-d', 'allowEmpty' => true, 'startView' => 'decades');
$add_args = I2CE::getConfig()->getAsArray("/modules/DatePicker/options");
if (is_array($add_args)) {
$args = array_merge($args, $add_args);
}
$template->addDatePicker('datepicker_ymd', $args);
} else {
I2CE_Date::addMonthDayElement($template, $ele_name, $default, $this->hasInvalid(), $node);
I2CE_Date::addYearElement($template, $ele_name, $default, $this->hasInvalid(), $node, $this->getYearRange(), false, true);
}
}
示例9: addMapDefaults
/**
* Add any necessary defaults to the given map details.
* This is currently just a default view and any layers
* defined in the _order, but not in the layers data.
* @param array &$maps The maps data
*/
public function addMapDefaults(&$maps)
{
$config = I2CE::getConfig()->modules->OpenLayers;
if ($config->is_parent('default')) {
$defaults = array('_height', '_width');
foreach ($defaults as $default) {
if (!array_key_exists($default, $maps) && $config->default->is_scalar($default)) {
$maps[$default] = $config->default->{$default};
}
}
foreach ($maps as $map_name => &$map) {
if ($map_name[0] == '_') {
continue;
}
if ($config->is_parent("default/layers")) {
if (array_key_exists('layers', $map) && is_array($map['layers']) && array_key_exists('_order', $map['layers']) && is_array($map['layers']['_order'])) {
foreach ($map['layers']['_order'] as $layer => $order) {
if (!array_key_exists($layer, $map['layers']) && $config->is_parent("default/layers/{$layer}")) {
$map['layers'][$layer] = $config->default->layers->{$layer}->getAsArray();
}
}
}
}
if ($config->is_parent("default/view")) {
if (array_key_exists('view', $map)) {
$map['view'] = array_merge($config->default->view->getAsArray(), $map['view']);
} else {
$map['view'] = $config->default->view->getAsArray();
}
}
}
}
}
示例10: ensureLimits
protected function ensureLimits()
{
if ($this->ensured) {
return;
}
if ($this->storage->is_scalar()) {
return false;
}
if (!$this->parent instanceof I2CE_Swiss_CustomReports_Report_ReportingForm_Field) {
return false;
}
$factory = I2CE_FormFactory::instance();
$formName = $this->parent->getForm();
$formObj = $factory->createForm($formName);
if (!$formObj instanceof I2CE_Form) {
I2CE::raiseError("Could not instantiate the form {$formName} at " . $this->configPath);
return false;
}
$field = $this->parent->getName();
$allowed_limits = $formObj->getLimitStyles($field);
$excludes = I2CE::getConfig()->getAsArray("/modules/CustomReports/limit_excludes/displayed");
foreach ($allowed_limits as $limit => $data) {
if (in_array($limit, $excludes)) {
continue;
}
$swissLimit = $this->getChild($limit, true);
if (is_array($data) && count($data) == 1 && in_array('value', $data)) {
$swissLimit->setAllowPivot(true);
} else {
$swissLimit->setAllowPivot(false);
}
}
$this->ensured = true;
}
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:34,代码来源:I2CE_Swiss_CustomReports_Report_ReportingForm_Field_Limits.php
示例11: displayValues
public function displayValues($content_node, $transient_options, $action)
{
if (!($mainNode = $this->template->appendFileByNode('swiss_formfield_headers.html', 'div', $content_node)) instanceof DOMNode || !($headersNode = $this->template->getElementByName('headers_body', 0, $mainNode)) instanceof DOMNode) {
I2CE::raiseError("Could not load headers template");
return false;
}
$headers = $this->storage->getAsArray();
$inputs = array('new_key', 'new_val', 'do_new');
$delete = 'Delete Header';
I2CE::getConfig()->setIfIsSet($delete, "/modules/form-builder/messages/delete_header");
foreach ($headers as $key => $val) {
if (!is_scalar($val) && !$val === null) {
continue;
}
$headersNode->appendChild($trNode = $this->template->createElement('tr'));
$trNode->appendChild($keyNode = $this->template->createElement('td'));
$trNode->appendChild($valNode = $this->template->createElement('td'));
$keyNode->appendChild($labelNode = $this->template->createElement('h3'));
$labelNode->appendChild($this->template->createTextNode($key));
$input = 'val[' . $key . ']';
$inputs[] = $input;
$valNode->appendChild($this->template->createElement('input', array('value' => $val, 'name' => $input)));
$valNode->appendChild($this->template->createElement('br'));
$input = 'delete[' . $key . ']';
$inputs[] = $input;
$keyNode->appendChild($this->template->createElement('input', array('type' => 'checkbox', 'value' => 1, 'name' => $input)));
$keyNode->appendChild($this->template->createTextNode($delete));
}
if (($newNode = $this->template->getElementByName('new_key', 0, $mainNode)) instanceof DOMNode) {
$this->template->setClassValue($newNode, 'validate_data', array('notinlist' => array_keys($headers)), '%');
}
$this->renameInputs($inputs, $mainNode);
return true;
}
示例12: displayMeta
protected function displayMeta($mainNode, $transient_options, $action)
{
if (($styleNode = $this->template->getElementByName('style', 0, $mainNode)) instanceof DOMNode) {
$styles = I2CE::getConfig()->getKeys("/I2CE/template/page_styles");
$selected_style = $this->getField('style');
foreach ($styles as $style) {
$attrs = array('value' => $style);
if ($style == $selected_style && $selected_style != '' || $style == 'shell' && $selected_style == '') {
$attrs['selected'] = 'selected';
}
$styleNode->appendChild($this->template->createElement('option', $attrs, $style));
}
$this->renameInputs('style', $mainNode);
}
if (($descNode = $this->template->getElementByName('description', 0, $mainNode)) instanceof DOMNode) {
$this->template->setDisplayData("page", $this->name, $descNode);
$this->template->setDisplayData("class", $this->getField('class'), $descNode);
}
if (($linkNode = $this->template->getElementByName('link_name', 0, $mainNode)) instanceof DOMNode) {
$page = $this->getName();
$url = I2CE_Page::getAccessedBaseURL() . '/' . $page;
$c = 0;
$formids = $this->getSampleIDs();
foreach ($formids as $formid) {
$this->template->setDisplayDataImmediate("link_title_" . $c, "{$page} {$c}", $linkNode);
$this->template->setDisplayDataImmediate("page_edit_link_" . $c, "{$url}?id={$formid}", $linkNode);
$c++;
}
return true;
}
}
示例13: upgrade
/**
* Upgrade this module if necessary
* @param string $old_vers
* @param string $new_vers
* @return boolean
*/
public function upgrade($old_vers, $new_vers)
{
/*
* In 3.2.3 we moved some lists from entry to magicdata storage so we need to get the
* old data from entry and save them to the new form storage.
*/
if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.3')) {
$user = new I2CE_User(1, false, false, false);
$class_config = I2CE::getConfig()->modules->forms->formClasses;
$migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
if (!I2CE_FormStorage::migrateForm("facility_type", "entry", $user, $migrate_path, false, array("type"))) {
return false;
}
if (I2CE_FormStorage::migrateForm("facility", "entry", $user, $migrate_path, false, array("type"), array("facility_type" => "facility_type", "location" => array("county" => "county", "district" => "district", "country" => "country")))) {
unset($class_config->iHRIS_Facility->fields->country);
unset($class_config->iHRIS_Facility->fields->district);
unset($class_config->iHRIS_Facility->fields->county);
unset($class_config->iHRIS_Facility->fields->type);
} else {
return false;
}
} elseif (I2CE_Validate::checkVersion($old_vers, '<', '3.2.4')) {
$user = new I2CE_User(1, false, false, false);
$class_config = I2CE::getConfig()->modules->forms->formClasses;
$migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
if (!I2CE_FormStorage::migrateForm("facility", "entry", $user, $migrate_path, false, array("type"))) {
return false;
}
unset($class_config->iHRIS_Facility->fields->type);
}
return parent::upgrade($old_vers, $new_vers);
}
示例14: displayArgs
public function displayArgs($mainNode, $transient_options, $action)
{
// Display the action link's form field
$this->template->setDisplayDataImmediate('formfield', $this->getField('formfield'), $mainNode);
// Display the action link's link location
$this->template->setDisplayDataImmediate('linkloc', $this->getField('href'), $mainNode);
// Display the action link's link text field
$this->template->setDisplayDataImmediate('linktext', $this->getField('text'), $mainNode);
// Rename the inputs to include swiss instance path
$inputs = array('linkloc', 'formfield', 'linktext');
if (($taskNode = $this->template->getElementByName('task', 0, $mainNode)) instanceof DOMNode) {
$tasks = I2CE::getConfig()->getAsArray("/I2CE/tasks/task_description");
$selected_task = $this->getField('task');
foreach ($tasks as $task => $desc) {
$attrs = array('value' => $task, 'title' => $desc);
if ($task == $selected_task) {
$attrs['selected'] = 'selected';
}
$taskNode->appendChild($this->template->createElement('option', $attrs, $task));
}
$inputs[] = 'task';
}
$this->renameInputs($inputs, $mainNode);
return true;
}
示例15: displayArgs
public function displayArgs($mainNode, $transient_options, $action)
{
if (!parent::displayArgs($mainNode, $transient_options, $action)) {
return false;
}
if (($relNode = $this->template->getElementByName('relationship', 0, $mainNode)) instanceof DOMNode) {
$relationships = I2CE::getConfig()->getKeys("/modules/CustomReports/relationships");
$selected_rel = $this->getField('relationship');
foreach ($relationships as $relationship) {
$attrs = array('value' => $relationship);
if ($relationship == $selected_rel) {
$attrs['selected'] = 'selected';
}
$title = false;
if (I2CE::getConfig()->setIfIsSet($title, "/modules/CustomReports/relationships/{$relationship}/display_name")) {
$attrs['title'] = $title;
}
$relNode->appendChild($this->template->createElement('option', $attrs, $relationship));
}
if ($selected_rel) {
$this->template->setDisplayDataImmediate('has_relationship', 1, $mainNode);
$this->template->setDisplayDataImmediate('relationship_link', "CustomReports/edit/relationships/" . $selected_rel, $mainNode);
} else {
$this->template->setDisplayDataImmediate('has_relationship', 0, $mainNode);
}
}
$this->renameInputs(array('relationship'), $mainNode);
return true;
}