本文整理汇总了PHP中I2CE类的典型用法代码示例。如果您正苦于以下问题:PHP I2CE类的具体用法?PHP I2CE怎么用?PHP I2CE使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了I2CE类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
}
}
}
}
示例2: 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);
}
示例3: display
public function display($supress_output = false)
{
if (!array_key_exists('HTTP_HOST', $_SERVER)) {
exit("No command line usage for this page");
}
if (!$this->get_exists('delay_index')) {
I2CE::raiseError("Invalid tree data request: 'request' is missing");
return false;
}
$delay_index = $this->get('delay_index');
if (!array_key_exists('tree_data', $_SESSION) || !is_array($_SESSION['tree_data']) || !array_key_exists($delay_index, $_SESSION['tree_data'])) {
return false;
}
$data = $_SESSION['tree_data'][$delay_index];
unset($_SESSION['tree_data'][$delay_index]);
if (!is_array($data)) {
return false;
}
$template = new I2CE_Template();
$template->loadRootText("<span id='root'>");
$root = $template->getElementById('root');
$doc = $template->getDoc();
I2CE_Module_TreeSelect::createTreeData($template, $root, $data);
$tdoc = new DOMDocument();
$tdoc->appendChild($tdoc->importNode($root, true));
echo $tdoc->saveHTML();
die;
}
示例4: loadObjects
/**
* Create and load data for the objects used for this form.
*
* Create the list object and if this is a form submission load
* the data from the form data.
*/
protected function loadObjects()
{
$factory = I2CE_FormFactory::instance();
if ($this->isPost()) {
$trainingprovider = $factory->createContainer('trainingprovider');
if (!$trainingprovider instanceof iHRIS_TrainingProvider) {
I2CE::raiseError("Could not create trainingprovider form");
return;
}
$trainingprovider->load($this->post);
$name_ignore = $trainingprovider->getField('name_ignore');
$ignore_path = array('forms', 'trainingprovider', $trainingprovider->getID(), 'ignore', 'name');
if ($name_ignore instanceof I2CE_FormField && $this->post_exists($ignore_path)) {
$name_ignore->setFromPost($this->post($ignore_path));
}
} else {
if ($this->get_exists('id')) {
$id = $this->get('id');
if (strpos($id, '|') === false) {
I2CE::raiseError("Depcreated use of id variable");
$id = 'trainingprovider|' . $id;
}
} else {
$id = 'trainingprovider|0';
}
$trainingprovider = $factory->createContainer($id);
if (!$trainingprovider instanceof iHRIS_TrainingProvider) {
I2CE::raiseError("Could not create valid trainingprovider form from id:{$id}");
return;
}
$trainingprovider->populate();
}
$this->setObject($trainingprovider);
}
示例5: 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;
}
示例6: displayValues
public function displayValues($contentNode, $transient_options, $action)
{
$mainNode = $this->template->appendFileByNode('view_relationship_forms.html', 'div', $contentNode);
if (!$mainNode instanceof DOMNode) {
I2CE::raiseError("Unable to add reported form list template");
return false;
}
$listNode = $this->template->getElementById('report_forms_list', $mainNode);
if (!$listNode instanceof DOMElement) {
I2CE::raiseError("Don't knwo where to add forms");
return false;
}
$swissRelationshipForms = $this->getSwissFormsInRelationship();
foreach ($swissRelationshipForms as $form => $swissRelationshipForm) {
if ($swissRelationshipForm instanceof I2CE_Swiss_FormRelationship_Join) {
$swissForm = $this->getChild($form, true);
} else {
$swissForm = $this->getChild('primary_form', true);
}
if (!$swissForm instanceof I2CE_Swiss_CustomReports_Report_ReportingForm) {
continue;
}
$formNode = $this->template->appendFileByNode('customReports_report_forms_each.html', 'li', $listNode);
if (!$formNode instanceof DOMNode) {
continue;
}
$this->template->setDisplayDataImmediate('name', $form, $formNode);
$swissForm->addAjaxLink('form_link', 'form_contents', 'form_ajax', $formNode, $action, $transient_options);
}
return true;
}
示例7: 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
示例8: generateUUID
/**
* Wrapper function to fenerates a UUID via the pecl uuid module.
* More {@link http://pwet.fr/man/linux/fonctions_bibliotheques/ossp/uuid doucmentation} on ossp uuid.
*
* <br/>
* Version 1 UUIDs are guaranteed to be unique through combinations of hardware addresses, time stamps and random seeds. There is a reference in the UUID to the hardware (MAC) address of the first network interface card (NIC) on the host which generated the UUID this reference is intended to ensure the UUID will be unique in space as the MAC address of every network card is assigned by a single global authority (IEEE) and is guaranteed to be unique. The next component in a UUID is a timestamp which, as clock always (should) move forward, will be unique in time. Just in case some part of the above goes wrong (the hardware address cannot be determined or the clock moved steps backward), there is a random clock sequence component placed into the UUID as a catch-all for uniqueness.
* <br/>
* Version 3 and version 5 UUIDs are guaranteed to be inherently globally unique if the combination of namespace and name used to generate them is unique. It is not supported at the moment
* <br/>
* Version 4 UUIDs are not guaranteed to be globally unique, because they are generated out of locally gathered pseudo-random numbers only. Nevertheless there is still a high likelihood of uniqueness over space and time and that they are computationally difficult to guess.
* *
* http://manpages.ubuntu.com/manpages/dapper/man3/uuid.3ossp.html
* V1 -- Time an node
* V4 -- random data
*
* @param string $version. Defaults to 1
* @retruns mixed string or false on failure
*/
public static function generateUUID($version = 4)
{
switch ($version) {
case 3:
I2CE::raiseError("Version 3 not supported");
return false;
break;
case 5:
I2CE::raiseError("Version 5 not supported");
return false;
break;
case 4:
$version = UUID_TYPE_RANDOM;
break;
default:
case 1:
$version = UUID_TYPE_DEFAULT;
break;
}
// if ( 0 != uuid_make ( self::$uuidobject, $version ) > 0 ) { //i think it returns a non-zero on failure
// return false;
// }
// uuid_export ( self::$uuidobject, UUID_FMT_STR, &$uuidstring );
return trim(uuid_create($version));
}
示例9: 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);
}
}
示例10: 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;
}
示例11: action_initialize
/**
* Make sure the float column is in the database in the entry/last entry tables.
*/
public function action_initialize()
{
//check to see that the large blobs are there.
foreach (array('entry', 'last_entry') as $table) {
$qry_show = "SHOW COLUMNS FROM {$table} LIKE '%_value'";
$qry_alter = "ALTER TABLE {$table} ADD COLUMN `float_value` float";
$results = $this->db->query($qry_show);
if (I2CE::pearError($results, "Error getting columns from {$table} table: on {$qry_show}")) {
return false;
}
$found = false;
while ($row = $results->fetchRow()) {
if ($row->field == 'float_value') {
$found = true;
}
}
if (!$found) {
//add the blob column to last_entry
if (I2CE::pearError($this->db->exec($qry_alter), "Error adding float column to {$table}:")) {
return false;
}
}
}
return true;
}
示例12: processResultRow
/**
* Process a result row.
* @param array $row
* @param int $row_num The current row number when processing results. If there was a result limit, it starts the count from the beginning of the
* result offset. Othwerwise, it starts counting form zero.
* @param DOMNode $contentNode. Default to null. A node to append the result onto
*/
protected function processResultRow($row, $row_num, $contentNode = null)
{
parent::processResultRow($row, $row_num, $contentNode);
$per_page = (int) $this->defaultOptions['limit_per_page'];
if ($per_page < 1) {
//check it is not bad, if so make it something reasonable -- in fact make it the default per page in I2CE_CustomReport_Display
$per_page = 100;
}
$page = (int) $this->defaultOptions['limit_page'];
//$page = (int) $this->page->request('limit_page');
if ($page < 1) {
$page = 1;
}
$appendCount = $row_num - ($page - 1) * $per_page;
$cellNode = $this->template->appendFileByName("customReports_table_data_cell.html", "td", "report_row", $appendCount, null, true);
if (!$cellNode instanceof DOMNode) {
I2CE::raiseError("Could not add data cell to table");
return false;
}
$field_args = array();
foreach ($this->page->getActionFields() as $field) {
$field_args[] = $row->{$field};
}
$actionNode = $this->page->getActionNode($field_args);
$this->template->appendNode($actionNode, $cellNode);
return true;
}
示例13: 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;
}
示例14: displayValues
public function displayValues($content_node, $transient_options, $action)
{
if (!($mainNode = $this->template->appendFileByNode($this->getContainerTemplate(), 'div', $content_node)) instanceof DOMNode || !($containerNode = $this->template->getElementByName('forms', 0, $mainNode))) {
I2CE::raiseError("Could not load " . $this->getContainerTemplate());
return false;
}
if (($formsNode = $this->template->getElementByName('form', 0, $mainNode)) instanceof DOMNode) {
$forms = array_diff($this->getAllowedForms(), $this->storage->getKeys());
foreach ($forms as $form) {
$formsNode->appendChild($this->template->createElement('option', array('value' => $form), $form));
}
}
$this->renameInputs(array('form'), $mainNode);
foreach ($this->storage->getKeys() as $name) {
$containerNode->appendChild($liNode = $this->template->createElement('li'));
if (!($childNode = $this->template->appendFileByNode($this->getFormTemplate(), 'div', $liNode)) instanceof DOMNode || !($swissChild = $this->getChild($name)) instanceof I2CE_Swiss) {
continue;
}
$this->template->setDisplayDataImmediate('name', $name, $childNode);
$swissChild->addAjaxLink('form_link', $this->getAjaxContainer(), 'form_ajax', $childNode, $action, $transient_options);
$delete_link = $swissChild->getURLRoot('delete_class') . $swissChild->path;
$this->template->setDisplayDataImmediate('delete_link', $delete_link, $childNode);
}
return true;
}
示例15: action
public function action()
{
parent::action();
$init_options = array('root_path' => '/modules/forms/storage_options/CSD/remote_services', 'root_path_create' => true, 'root_url' => 'remote_directory_selector', 'root_type' => 'ServiceDirectorySelector');
try {
$swiss_factory = new I2CE_SwissMagicFactory($this, $init_options);
} catch (Exception $e) {
I2CE::raiseError("Could not create swissmagic for selectable" . $e->getMessage());
return false;
}
try {
$swiss_factory->setRootSwiss();
} catch (Exception $e) {
I2CE::raiseError("Could not create root swissmagic for selectable" . $e->getMessage());
return false;
}
$swiss_path = $this->request_remainder;
$action = array_shift($swiss_path);
if ($action == 'update' && $this->isPost()) {
if ($swiss_factory->updateValues($this->post())) {
$this->userMessage("Updated Remote Directories");
} else {
$this->userMessage("Unable To Update Remote Directories");
}
$this->setRedirect('home');
}
$action = 'edit';
return $swiss_factory->displayValues($this->template->getElementById('siteContent'), $swiss_path, $action);
}