本文整理汇总了PHP中I2CE_FormStorage::getStorage方法的典型用法代码示例。如果您正苦于以下问题:PHP I2CE_FormStorage::getStorage方法的具体用法?PHP I2CE_FormStorage::getStorage怎么用?PHP I2CE_FormStorage::getStorage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类I2CE_FormStorage
的用法示例。
在下文中一共展示了I2CE_FormStorage::getStorage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getStaleTime
/**
*Get the time the cached form is considered stale
* @returns int the number of seconds for this form to be considered stale. if 0 it is considered to be always stale
*/
public function getStaleTime()
{
$timeConfig = I2CE::getConfig()->modules->CachedForms->times;
$stale_time = 10;
$timeConfig->setIfIsSet($stale_time, "stale_time");
if (is_integer($stale_time) || is_string($stale_time) && ctype_digit($stale_time)) {
if ($stale_time <= 0) {
return 0;
}
} else {
$stale_time = 10;
}
//lookup storage mechanism stale time and override if necc.
$t_stale_time = null;
if ($timeConfig->setIfIsSet($t_stale_time, "stale_time_by_mechanism/" . I2CE_FormStorage::getStorage($this->form))) {
if (is_integer($t_stale_time) || is_string($t_stale_time) && ctype_digit($t_stale_time)) {
if ($t_stale_time > 0) {
$stale_time = $t_stale_time;
} else {
return 0;
}
}
}
//lookup form stale time and override if necc.
$t_stale_time = null;
if ($timeConfig->setIfIsSet($t_stale_time, "stale_time_by_form/{$this->form}")) {
if (is_integer($t_stale_time) || is_string($t_stale_time) && ctype_digit($t_stale_time)) {
if ($t_stale_time > 0) {
$stale_time = $t_stale_time;
} else {
return 0;
}
}
}
$stale_time = $stale_time * 60;
//convert from minutes
return $stale_time;
}
示例2: getMappedCodeLists
/**
* Gets any code lists that are already mapped in the system
* @param string $form
* @returns boolean
*/
protected function getMappedCodeLists($form, $field)
{
if (array_key_exists($form, $this->mapping_data) && array_key_exists($field, $this->mapping_data[$form])) {
return $this->mapping_data[$form][$field];
}
if (!array_key_exists($form, $this->mapping_data)) {
$this->mapping_data[$form] = array();
}
$options = $this->getStorageOptions($form);
if (!$options instanceof I2CE_MagicDataNode) {
I2CE::raiseError("Invalid SDMX_CrossSectional storage options for {$form}");
//shouldn't happen at this point
return false;
}
$mapData = false;
//do something to populate the mapping data
if ($field == 'parent') {
$mapPath = "parent/map_data";
} else {
$mapPath = "fields/{$field}/map_data";
}
if ($options->is_scalar($mapPath . '/list') && $options->is_scalar($mapPath . '/codelist')) {
$list = $option->{$mapPath}->list;
$codelist = $option->{$mapPath}->codelist;
if ($list && $codelist) {
$mapData = array();
//we have a list and a codelist set so we should attempt to get the mapping data at this point
if (I2CE_FormFactory::instance()->exists($list)) {
$linkForm = 'list_linkto_list_' . I2CE_FormStorage::getStorage($options->{$mapPath}->list);
$options->setIfIsSet($linkForm, $mapPath . '/mapping_form');
$where = array('operator' => 'AND', 'operands' => array(0 => array('operator' => 'FIELD_LIMIT', 'field' => 'list', 'style' => 'like', 'data' => array('value' => $list . '|%')), 1 => array('operator' => 'FIELD_LIMIT', 'field' => 'like', 'style' => 'starts_with', 'data' => array('value' => $codelist . '|%'))));
$data = I2CE_FormStorage::listFields($linkForm, array('list', 'links_to'), false, $where);
}
$codelist_len = strlen($codelist) + 1;
foreach ($data as $id => $vals) {
if (!is_array($vals) || !array_key_exists('list', $vals) || !array_key_exists('links_to', $vals) || strlen($vals['links_to'] <= $codelist_len)) {
continue;
}
//chop of the $codelist| from the links to value and store it.
$data[substr($vals['codelist'], $codelist_len)] = $vals['list'];
}
}
}
$this->mapping_data[$form][$field] = $mapData;
return $this->mapping_data[$form][$field];
}