当前位置: 首页>>代码示例>>PHP>>正文


PHP ca_list_items::getPrimaryKey方法代码示例

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


在下文中一共展示了ca_list_items::getPrimaryKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Edit

 public function Edit($pa_values = NULL, $pa_options = NULL)
 {
     parent::Edit($pa_values, $pa_options);
     // Set last browse ID so when we return to the ca_list_items hierarchy browser from
     // the editing screen it defaults to the list we just edited
     $vn_list_id = $this->request->getParameter('list_id', pInteger);
     $t_list_item = new ca_list_items();
     if ($t_list_item->load(array('list_id' => $vn_list_id, 'parent_id' => null))) {
         // root ca_list_item record for this ca_list record
         $this->request->session->setVar('ca_list_items_browse_last_id', $t_list_item->getPrimaryKey());
     }
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:12,代码来源:ListEditorController.php

示例2: caNavIcon

						</td>
						<td>
							<a href="#" class="caDeleteItemButton"><?php 
    print caNavIcon($this->request, __CA_NAV_BUTTON_DEL_BUNDLE__);
    ?>
</a>
						</td>
					</tr>
				</table>
<?php 
} else {
    $vn_use_as_root_id = 'null';
    if (sizeof($va_settings['restrict_to_lists']) == 1) {
        $t_item = new ca_list_items();
        if ($t_item->load(array('list_id' => $va_settings['restrict_to_lists'][0], 'parent_id' => null))) {
            $vn_use_as_root_id = $t_item->getPrimaryKey();
        }
    }
    ?>
				<div style="float: right;"><a href="#" class="caDeleteItemButton"><?php 
    print caNavIcon($this->request, __CA_NAV_BUTTON_DEL_BUNDLE__);
    ?>
</a></div>

				<div style='width: 700px; height: <?php 
    print $va_settings['hierarchicalBrowserHeight'];
    ?>
;'>
					
					<div id='<?php 
    print $vs_id_prefix;
开发者ID:samrahman,项目名称:providence,代码行数:31,代码来源:ca_list_items.php

示例3: caEditorInspector

/**
 * Generates standard-format inspector panels for editors
 *
 * @param View $po_view Inspector view object
 * @param array $pa_options Optional array of options. Supported options are:
 *		backText = a string to use as the "back" button text; default is "Results"
 *
 * @return string HTML implementing the inspector
 */
function caEditorInspector($po_view, $pa_options = null)
{
    require_once __CA_MODELS_DIR__ . '/ca_sets.php';
    require_once __CA_MODELS_DIR__ . '/ca_data_exporters.php';
    $t_item = $po_view->getVar('t_item');
    $vs_table_name = $t_item->tableName();
    if (($vs_priv_table_name = $vs_table_name) == 'ca_list_items') {
        $vs_priv_table_name = 'ca_lists';
    }
    $vn_item_id = $t_item->getPrimaryKey();
    $o_result_context = $po_view->getVar('result_context');
    $t_ui = $po_view->getVar('t_ui');
    $t_type = method_exists($t_item, "getTypeInstance") ? $t_item->getTypeInstance() : null;
    $vs_type_name = method_exists($t_item, "getTypeName") ? $t_item->getTypeName() : '';
    if (!$vs_type_name) {
        $vs_type_name = $t_item->getProperty('NAME_SINGULAR');
    }
    $va_reps = $po_view->getVar('representations');
    $o_dm = Datamodel::load();
    if ($t_item->isHierarchical()) {
        $va_ancestors = $po_view->getVar('ancestors');
        $vn_parent_id = $t_item->get($t_item->getProperty('HIERARCHY_PARENT_ID_FLD'));
    } else {
        $va_ancestors = array();
        $vn_parent_id = null;
    }
    // action extra to preserve currently open screen across next/previous links
    $vs_screen_extra = $po_view->getVar('screen') ? '/' . $po_view->getVar('screen') : '';
    if ($vs_type_name == "list item") {
        $vs_style = "style='height:auto;'";
    }
    if ($vn_item_id | $po_view->request->getAction() === 'Delete') {
        $vs_buf = '<h3 class="nextPrevious" ' . $vs_style . '>' . caEditorFindResultNavigation($po_view->request, $t_item, $o_result_context, $pa_options) . "</h3>\n";
    }
    $vs_color = null;
    if ($t_type) {
        $vs_color = trim($t_type->get('color'));
    }
    if (!$vs_color && $t_ui) {
        $vs_color = trim($t_ui->get('color'));
    }
    if (!$vs_color) {
        $vs_color = "FFFFFF";
    }
    $vs_buf .= "<h4><div id='caColorbox' style='border: 6px solid #{$vs_color};'>\n";
    $vs_icon = null;
    if ($t_type) {
        $vs_icon = $t_type->getMediaTag('icon', 'icon');
    }
    if (!$vs_icon && $t_ui) {
        $vs_icon = $t_ui->getMediaTag('icon', 'icon');
    }
    if ($vs_icon) {
        $vs_buf .= "<div id='inspectoricon' style='border-right: 6px solid #{$vs_color}; border-bottom: 6px solid #{$vs_color}; -moz-border-radius-bottomright: 8px; -webkit-border-bottom-right-radius: 8px;'>\n{$vs_icon}</div>\n";
    }
    if ($po_view->request->getAction() === 'Delete' && $po_view->request->getParameter('confirm', pInteger)) {
        $vs_buf .= "<strong>" . _t("Deleted %1", $vs_type_name) . "</strong>\n";
        $vs_buf .= "<br style='clear: both;'/></div></h4>\n";
    } else {
        if ($vn_item_id) {
            if (!$po_view->request->config->get("{$vs_priv_table_name}_inspector_disable_headline")) {
                if ($po_view->request->user->canDoAction("can_edit_" . $vs_priv_table_name) && sizeof($t_item->getTypeList()) > 1) {
                    $vs_buf .= "<strong>" . _t("Editing %1", $vs_type_name) . ": </strong>\n";
                } else {
                    $vs_buf .= "<strong>" . _t("Viewing %1", $vs_type_name) . ": </strong>\n";
                }
            }
            if ($t_item->hasField('is_deaccessioned') && $t_item->get('is_deaccessioned') && $t_item->get('deaccession_date', array('getDirectDate' => true)) <= caDateToHistoricTimestamp(_t('now'))) {
                // If currently deaccessioned then display deaccession message
                $vs_buf .= "<br/><div class='inspectorDeaccessioned'>" . _t('Deaccessioned %1', $t_item->get('deaccession_date')) . "</div>\n";
                if ($vs_deaccession_notes = $t_item->get('deaccession_notes')) {
                    TooltipManager::add(".inspectorDeaccessioned", $vs_deaccession_notes);
                }
            } else {
                if ($po_view->request->user->canDoAction('can_see_current_location_in_inspector_ca_objects')) {
                    if ($t_ui && method_exists($t_item, "getObjectHistory") && (is_array($va_placements = $t_ui->getPlacementsForBundle('ca_objects_history')) && sizeof($va_placements) > 0)) {
                        //
                        // Output current "location" of object in life cycle. Configuration is taken from a ca_objects_history bundle configured for the current editor
                        //
                        $va_placement = array_shift($va_placements);
                        $va_bundle_settings = $va_placement['settings'];
                        if (is_array($va_history = $t_item->getObjectHistory($va_bundle_settings, array('limit' => 1, 'currentOnly' => true))) && sizeof($va_history) > 0) {
                            $va_current_location = array_shift(array_shift($va_history));
                            if (!($vs_inspector_current_location_label = $po_view->request->config->get("ca_objects_inspector_current_location_label"))) {
                                $vs_inspector_current_location_label = _t('Current');
                            }
                            if ($va_current_location['display']) {
                                $vs_buf .= "<div class='inspectorCurrentLocation'><strong>" . $vs_inspector_current_location_label . ':</strong><br/>' . $va_current_location['display'] . "</div>";
                            }
                        }
                    } elseif (method_exists($t_item, "getLastLocationForDisplay")) {
//.........这里部分代码省略.........
开发者ID:kai-iak,项目名称:providence,代码行数:101,代码来源:displayHelpers.php

示例4: saveInlineEdit

 /**
  * Save edits from "spreadsheet" (editable results) mode
  *
  */
 public function saveInlineEdit($pa_options = null)
 {
     global $g_ui_locale_id;
     $pa_changes = $this->request->getParameter("changes", pArray);
     $vs_resp = array();
     $o_dm = Datamodel::load();
     if (!is_array($pa_changes) || !sizeof($pa_changes)) {
         $va_resp['messages'][0] = _t("Nothing to save");
     } else {
         foreach ($pa_changes as $vn_i => $pa_change) {
             $ps_table = $pa_change['table'];
             $pa_bundle = explode("-", $ps_bundle = $pa_change['bundle']);
             $pn_id = (int) $pa_change['id'];
             $ps_val = $pa_change['value'];
             if (!($t_instance = $o_dm->getInstanceByTableName($ps_table, true))) {
                 $va_resp['errors'][$pn_id] = array('error' => 100, 'message' => _t('Invalid table: %1', $ps_table));
             } else {
                 if (!$t_instance->load($pn_id)) {
                     $va_resp['errors'][$pn_id] = array('error' => 100, 'message' => _t('Invalid id: %1', $pn_id));
                 } else {
                     if (!$t_instance->isSaveable($this->request)) {
                         $va_resp['errors'][$pn_id] = array('error' => 100, 'message' => _t('You are not allowed to edit this.'));
                     } elseif ($pa_bundle[0] == 'preferred_labels') {
                         if ($this->request->user->getBundleAccessLevel($ps_table, $pa_bundle[0]) != __CA_BUNDLE_ACCESS_EDIT__) {
                             $va_resp['errors'][$pn_id] = array('error' => 100, 'message' => _t('You are not allowed to edit this.'));
                         } else {
                             $vn_label_id = $t_instance->getPreferredLabelID($g_ui_locale_id);
                             $va_label_values = array();
                             if (sizeof($pa_bundle) == 1) {
                                 // is generic "preferred_labels"
                                 $va_label_values[$t_instance->getLabelDisplayField()] = $ps_val;
                             } else {
                                 $vs_preferred_label_element = $pa_bundle[1];
                                 $va_label_values[$vs_preferred_label_element] = $ps_val;
                             }
                             if ($vn_label_id) {
                                 $t_instance->editLabel($vn_label_id, $va_label_values, $g_ui_locale_id, null, true);
                                 // TODO: what about type?
                             } else {
                                 $t_instance->addLabel($va_label_values, $g_ui_locale_id, null, true);
                             }
                             if ($t_instance->numErrors()) {
                                 $va_resp['errors'][$pn_id] = array('error' => 100, 'message' => _t('Could not set preferred label %1 to %2: %3', $ps_bundle, $ps_val, join("; ", $t_instance->getErrors())));
                             } else {
                                 $va_resp['messages'][$pn_id] = array('message' => _t('Set preferred label %1 to %2', $ps_bundle, $ps_val), 'value' => $ps_val);
                             }
                         }
                     } elseif ($t_instance->hasField($ps_bundle)) {
                         if ($this->request->user->getBundleAccessLevel($ps_table, $ps_bundle) != __CA_BUNDLE_ACCESS_EDIT__) {
                             $va_resp['errors'][$pn_id] = array('error' => 100, 'message' => _t('You are not allowed to edit this.'));
                         } else {
                             // is it a list?
                             $t_list = new ca_lists();
                             $t_instance->setMode(ACCESS_WRITE);
                             if (($vs_list_code = $t_instance->getFieldInfo($ps_bundle, 'LIST')) && ($va_item = $t_list->getItemFromListByLabel($vs_list_code, $ps_val))) {
                                 $t_instance->set($ps_bundle, $va_item['item_value']);
                             } elseif (($vs_list_code = $t_instance->getFieldInfo($ps_bundle, 'LIST_CODE')) && ($vn_item_id = $t_list->getItemIDFromListByLabel($vs_list_code, $ps_val))) {
                                 $t_instance->set($ps_bundle, $vn_item_id);
                             } else {
                                 $t_instance->set($ps_bundle, $ps_val);
                             }
                             $t_instance->update();
                             if ($t_instance->numErrors()) {
                                 $va_resp['errors'][$pn_id] = array('error' => 100, 'message' => _t('Could not set %1 to %2: %3', $ps_bundle, $ps_val, join("; ", $t_instance->getErrors())));
                             } else {
                                 $va_resp['messages'][$pn_id] = array('message' => _t('Set %1 to %2', $ps_bundle, $ps_val), 'value' => $ps_val);
                             }
                         }
                     } elseif ($t_instance->hasElement($ps_bundle)) {
                         $vn_datatype = ca_metadata_elements::getElementDatatype($ps_bundle);
                         // Check if it repeats?
                         if ($vn_count = $t_instance->getAttributeCountByElement($ps_bundle) > 1) {
                             $va_resp['errors'][$pn_id] = array('error' => 100, 'message' => _t('Cannot edit <em>%1</em> here because it has multiple values. Try editing it directly.', mb_strtolower($t_instance->getDisplayLabel("{$ps_table}.{$ps_bundle}"))));
                         } elseif (!in_array($vn_datatype, array(1, 2, 3, 5, 6, 8, 9, 10, 11, 12))) {
                             // Check if it's a supported type?
                             $va_resp['errors'][$pn_id] = array('error' => 100, 'message' => _t('Cannot edit <em>%1</em> here. Try editing it directly.', mb_strtolower($t_instance->getDisplayLabel("{$ps_table}.{$ps_bundle}"))));
                         } elseif ($this->request->user->getBundleAccessLevel($ps_table, $ps_bundle) != __CA_BUNDLE_ACCESS_EDIT__) {
                             $va_resp['errors'][$pn_id] = array('error' => 100, 'message' => _t('You are not allowed to edit this.'));
                         } else {
                             // Do edit
                             $t_instance->setMode(ACCESS_WRITE);
                             $vs_val_proc = null;
                             if ($vn_datatype == 3) {
                                 if ($vn_id = ca_list_items::find(array('preferred_labels' => array('name_plural' => $ps_val)), array('returnAs' => 'firstId'))) {
                                     $t_instance->replaceAttribute(array('locale_id' => $g_ui_locale_id, $ps_bundle => $vn_id), $ps_bundle);
                                     // convert list codes to display text
                                     $t_list_item = new ca_list_items((int) $vn_id);
                                     if ($t_list_item->getPrimaryKey()) {
                                         $vs_val_proc = $t_list_item->get('ca_list_items.preferred_labels.name_plural');
                                     }
                                 }
                             } else {
                                 $t_instance->replaceAttribute(array('locale_id' => $g_ui_locale_id, $ps_bundle => $ps_val), $ps_bundle);
                             }
                             $t_instance->update();
                             if (!$vs_val_proc) {
//.........这里部分代码省略.........
开发者ID:ffarago,项目名称:pawtucket2,代码行数:101,代码来源:BaseFindController.php

示例5: _getListIDFromRequest

 /**
  * Helper to extract the list a new item is about to be inserted in from the request.
  * This is usually not passed as simple list_id parameter by the UI but through the parent_id.
  */
 private function _getListIDFromRequest($po_request)
 {
     if ($vn_list_id = $po_request->getParameter('list_id', pInteger)) {
         return $vn_list_id;
     }
     if ($vn_parent_id = $po_request->getParameter('parent_id', pInteger)) {
         $t_item = new ca_list_items($vn_parent_id);
         if ($t_item->getPrimaryKey()) {
             return $t_item->get('list_id');
         }
     }
     return false;
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:17,代码来源:ca_list_items.php

示例6: processDisplays

 public function processDisplays()
 {
     require_once __CA_MODELS_DIR__ . "/ca_bundle_displays.php";
     require_once __CA_MODELS_DIR__ . "/ca_bundle_display_placements.php";
     require_once __CA_MODELS_DIR__ . "/ca_bundle_display_type_restrictions.php";
     $o_config = Configuration::load();
     $vo_dm = Datamodel::load();
     if ($this->ops_base_name) {
         // "merge" profile and its base
         $va_displays = array();
         if ($this->opo_base->displays) {
             foreach ($this->opo_base->displays->children() as $vo_display) {
                 $va_displays[self::getAttribute($vo_display, "code")] = $vo_display;
             }
         }
         if ($this->opo_profile->displays) {
             foreach ($this->opo_profile->displays->children() as $vo_display) {
                 $va_displays[self::getAttribute($vo_display, "code")] = $vo_display;
             }
         }
     } else {
         if ($this->opo_profile->displays) {
             foreach ($this->opo_profile->displays->children() as $vo_display) {
                 $va_displays[self::getAttribute($vo_display, "code")] = $vo_display;
             }
         }
     }
     if (!is_array($va_displays) || sizeof($va_displays) == 0) {
         return true;
     }
     foreach ($va_displays as $vo_display) {
         $vs_display_code = self::getAttribute($vo_display, "code");
         $vb_system = self::getAttribute($vo_display, "system");
         $vs_table = self::getAttribute($vo_display, "type");
         if ($o_config->get($vs_table . '_disable')) {
             continue;
         }
         $t_display = $this->opb_updating ? ca_bundle_displays::find(array('code' => $vs_display_code, 'type' => $vs_table), array('returnAs' => 'firstModelInstance')) : false;
         $t_display = $t_display ? $t_display : new ca_bundle_displays();
         $t_display->setMode(ACCESS_WRITE);
         $t_display->set("display_code", $vs_display_code);
         $t_display->set("is_system", $vb_system);
         $t_display->set("table_num", $vo_dm->getTableNum($vs_table));
         $t_display->set("user_id", 1);
         // let administrative user own these
         $this->_processSettings($t_display, $vo_display->settings);
         if ($t_display->getPrimaryKey()) {
             $t_display->update();
         } else {
             $t_display->insert();
         }
         if ($t_display->numErrors()) {
             $this->addError("There was an error while inserting display {$vs_display_code}: " . join(" ", $t_display->getErrors()));
         } else {
             self::addLabelsFromXMLElement($t_display, $vo_display->labels, $this->opa_locales);
             if ($t_display->numErrors()) {
                 $this->addError("There was an error while inserting display label for {$vs_display_code}: " . join(" ", $t_display->getErrors()));
             }
             if (!$this->processDisplayPlacements($t_display, $vo_display->bundlePlacements, null)) {
                 return false;
             }
         }
         if ($vo_display->typeRestrictions) {
             foreach ($vo_display->typeRestrictions->children() as $vo_restriction) {
                 $t_list = new ca_lists();
                 $t_list_item = new ca_list_items();
                 $vs_restriction_code = trim((string) self::getAttribute($vo_restriction, "code"));
                 $vs_type = trim((string) self::getAttribute($vo_restriction, "type"));
                 $t_instance = $vo_dm->getInstanceByTableNum($vn_table_num = $vo_dm->getTableNum($vs_table));
                 $vs_type_list_name = $t_instance->getFieldListCode($t_instance->getTypeFieldName());
                 if ($vs_type) {
                     $t_list->load(array('list_code' => $vs_type_list_name));
                     $t_list_item->load(array('list_id' => $t_list->getPrimaryKey(), 'idno' => $vs_type));
                 }
                 $vn_type_id = $vs_type ? $t_list_item->getPrimaryKey() : null;
                 $t_restriction = $this->opb_updating ? ca_bundle_display_type_restrictions::find(array('table_num' => $vn_table_num, 'type_id' => $vn_type_id), array('returnAs' => 'firstModelInstance')) : false;
                 $t_restriction = $t_restriction ? $t_restriction : new ca_bundle_display_type_restrictions();
                 $t_restriction->setMode(ACCESS_WRITE);
                 $t_restriction->set('table_num', $vn_table_num);
                 $t_restriction->set('include_subtypes', (bool) $vo_restriction->includeSubtypes ? 1 : 0);
                 $t_restriction->set('type_id', $vn_type_id);
                 $t_restriction->set('display_id', $t_display->getPrimaryKey());
                 $this->_processSettings($t_restriction, $vo_restriction->settings);
                 if ($t_restriction->getPrimaryKey()) {
                     $t_restriction->update();
                 } else {
                     $t_restriction->insert();
                 }
                 if ($t_restriction->numErrors()) {
                     $this->addError("There was an error while inserting type restriction {$vs_restriction_code} in display {$vs_display_code}: " . join("; ", $t_restriction->getErrors()));
                 }
             }
         }
         if ($vo_display->userAccess) {
             $t_user = new ca_users();
             $va_display_users = array();
             foreach ($vo_display->userAccess->children() as $vo_permission) {
                 $vs_user = trim((string) self::getAttribute($vo_permission, "user"));
                 $vn_access = $this->_convertUserGroupAccessStringToInt(self::getAttribute($vo_permission, 'access'));
                 if ($vn_access && $t_user->load(array('user_name' => $vs_user))) {
//.........这里部分代码省略.........
开发者ID:idiscussforum,项目名称:providence,代码行数:101,代码来源:Installer.php

示例7: getFacetHierarchyAncestorList

 /**
  * Given a item_id (request parameter 'id') returns a list of ancestors for use in the hierarchy browser
  * Returned data is JSON format
  */
 public function getFacetHierarchyAncestorList()
 {
     $pn_id = $this->request->getParameter('id', pInteger);
     $ps_facet_name = $this->request->getParameter('facet', pString);
     if (!is_array($va_facet_info = $this->opo_browse->getInfoForFacet($ps_facet_name))) {
         return null;
     }
     $va_ancestors = array();
     switch ($va_facet_info['type']) {
         case 'attribute':
             // is it a list attribute?
             $t_element = new ca_metadata_elements();
             if ($t_element->load(array('element_code' => $va_facet_info['element_code']))) {
                 if ($t_element->get('datatype') == 3) {
                     // 3=list
                     if (!$pn_id) {
                         $t_list = new ca_lists();
                         $pn_id = $t_list->getRootListItemID($t_element->get('list_id'));
                     }
                     $t_item = new ca_list_items($pn_id);
                     if ($t_item->getPrimaryKey()) {
                         $va_ancestors = array_reverse($t_item->getHierarchyAncestors(null, array('includeSelf' => true, 'idsOnly' => true)));
                         array_shift($va_ancestors);
                     }
                 }
             }
             break;
         case 'label':
             // label facet
             $va_facet_info['table'] = $this->ops_tablename;
             // fall through to default case
         // fall through to default case
         default:
             $t_item = $this->opo_datamodel->getInstanceByTableName($va_facet_info['table']);
             $t_item->load($pn_id);
             if (method_exists($t_item, "getHierarchyList")) {
                 $va_access_values = caGetUserAccessValues($this->request);
                 $va_facet = $this->opo_browse->getFacet($ps_facet_name, array('sort' => 'name', 'checkAccess' => $va_access_values));
                 $va_hierarchy_list = $t_item->getHierarchyList(true);
                 $vn_hierarchies_in_use = 0;
                 foreach ($va_hierarchy_list as $vn_i => $va_item) {
                     if (isset($va_facet[$va_item[$t_item->primaryKey()]])) {
                         $vn_hierarchies_in_use++;
                         if ($vn_hierarchies_in_use > 1) {
                             break;
                         }
                     }
                 }
             }
             if ($t_item->getPrimaryKey()) {
                 $va_ancestors = array_reverse($t_item->getHierarchyAncestors(null, array('includeSelf' => true, 'idsOnly' => true)));
                 if (!is_array($va_ancestors)) {
                     $va_ancestors = array();
                 }
             }
             if ($vn_hierarchies_in_use <= 1) {
                 array_shift($va_ancestors);
             }
             break;
     }
     $this->view->setVar('ancestors', $va_ancestors);
     return $this->render('Browse/facet_hierarchy_ancestors_json.php');
 }
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:67,代码来源:BaseBrowseController.php

示例8: getDisplaysAsXML

 public function getDisplaysAsXML()
 {
     $t_display = new ca_bundle_displays();
     /** @var Datamodel $o_dm */
     $o_dm = Datamodel::load();
     $this->opt_locale = new ca_locales();
     $va_displays = $t_display->getBundleDisplays();
     $vs_buf = "<displays>\n";
     foreach ($va_displays as $vn_i => $va_display_by_locale) {
         $va_locales = array_keys($va_display_by_locale);
         $va_info = $va_display_by_locale[$va_locales[0]];
         if (!$t_display->load($va_info['display_id'])) {
             continue;
         }
         $vs_buf .= "\t<display code='" . ($va_info['display_code'] && preg_match('!^[A-Za-z0-9_]+$!', $va_info['display_code']) ? $va_info['display_code'] : 'display_' . $va_info['display_id']) . "' type='" . $o_dm->getTableName($va_info['table_num']) . "' system='" . $t_display->get('is_system') . "'>\n";
         $vs_buf .= "\t\t<labels>\n";
         foreach ($va_display_by_locale as $vn_locale_id => $va_display_info) {
             if (strlen($this->opt_locale->localeIDToCode($vn_locale_id)) > 0) {
                 $vs_buf .= "\t\t\t<label locale='" . $this->opt_locale->localeIDToCode($vn_locale_id) . "'><name>" . caEscapeForXML($va_display_info['name']) . "</name></label>\n";
             }
         }
         $vs_buf .= "\t\t</labels>\n";
         $va_settings = $t_display->getSettings();
         if (sizeof($va_settings) > 0) {
             $vs_buf .= "\t\t<settings>\n";
             foreach ($va_settings as $vs_setting => $vm_val) {
                 if (is_array($vm_val)) {
                     foreach ($vm_val as $vn_i => $vn_val) {
                         $vs_buf .= "\t\t\t<setting name='{$vs_setting}'><![CDATA[" . $vn_val . "]]></setting>\n";
                     }
                 } else {
                     $vs_buf .= "\t\t\t<setting name='{$vs_setting}'><![CDATA[" . $vm_val . "]]></setting>\n";
                 }
             }
             $vs_buf .= "\t\t</settings>\n";
         }
         // User and group access
         $va_users = $t_display->getUsers();
         if (sizeof($va_users) > 0) {
             $vs_buf .= "\t\t<userAccess>\n";
             foreach ($va_users as $va_user_info) {
                 $vs_buf .= "\t\t\t<permission user='" . $va_user_info["user_name"] . "' access='" . $this->_convertUserGroupAccessToString(intval($va_user_info['access'])) . "'/>\n";
             }
             $vs_buf .= "\t\t</userAccess>\n";
         }
         $va_groups = $t_display->getUserGroups();
         if (sizeof($va_groups) > 0) {
             $vs_buf .= "\t\t<groupAccess>\n";
             foreach ($va_groups as $va_group_info) {
                 $vs_buf .= "\t\t\t<permission group='" . $va_group_info["code"] . "' access='" . $this->_convertUserGroupAccessToString(intval($va_group_info['access'])) . "'/>\n";
             }
             $vs_buf .= "\t\t</groupAccess>\n";
         }
         $va_placements = $t_display->getPlacements();
         $vs_buf .= "<bundlePlacements>\n";
         foreach ($va_placements as $vn_placement_id => $va_placement_info) {
             $vs_buf .= "\t\t<placement code='" . preg_replace("![^A-Za-z0-9_]+!", "_", $va_placement_info['bundle_name']) . "'><bundle>" . $va_placement_info['bundle_name'] . "</bundle>\n";
             $va_settings = caUnserializeForDatabase($va_placement_info['settings']);
             if (is_array($va_settings)) {
                 $vs_buf .= "<settings>\n";
                 foreach ($va_settings as $vs_setting => $vm_value) {
                     switch ($vs_setting) {
                         case 'label':
                             if (is_array($vm_value)) {
                                 foreach ($vm_value as $vn_locale_id => $vm_locale_specific_value) {
                                     if (preg_match("/^[a-z]{2,3}\\_[A-Z]{2,3}\$/", $vn_locale_id)) {
                                         // locale code
                                         $vs_locale_code = $vn_locale_id;
                                     } else {
                                         if (!($vs_locale_code = $this->opt_locale->localeIDToCode($vn_locale_id))) {
                                             $vs_locale_code = 'en_US';
                                         }
                                     }
                                     $vs_buf .= "<setting name='label' locale='" . $vs_locale_code . "'>" . caEscapeForXML($vm_locale_specific_value) . "</setting>\n";
                                 }
                             }
                             break;
                         case 'restrict_to_relationship_types':
                             if (is_array($vm_value)) {
                                 foreach ($vm_value as $vn_val) {
                                     $t_rel_type = new ca_relationship_types($vn_val);
                                     if ($t_rel_type->getPrimaryKey()) {
                                         $vs_value = $t_rel_type->get('type_code');
                                         $vs_buf .= "\t\t\t\t<setting name='{$vs_setting}'><![CDATA[" . $vs_value . "]]></setting>\n";
                                     }
                                 }
                             }
                             break;
                         case 'restrict_to_types':
                             if (is_array($vm_value)) {
                                 foreach ($vm_value as $vn_val) {
                                     $t_item = new ca_list_items($vn_val);
                                     if ($t_item->getPrimaryKey()) {
                                         $vs_value = $t_item->get('idno');
                                         $vs_buf .= "\t\t\t\t<setting name='{$vs_setting}'><![CDATA[" . $vs_value . "]]></setting>\n";
                                     }
                                 }
                             }
                             break;
                         default:
//.........这里部分代码省略.........
开发者ID:idiscussforum,项目名称:providence,代码行数:101,代码来源:ConfigurationExporter.php

示例9: parseValue

 /**
  * @param mixed $ps_value
  * @param array $pa_element_info
  * @param array $pa_options Options are:
  *		alwaysTreatValueAsIdno = Always try to convert $ps_value to a list idno value, even if it is numeric
  *
  * @return array
  */
 public function parseValue($ps_value, $pa_element_info, $pa_options = null)
 {
     $vb_treat_value_as_idno = caGetOption('alwaysTreatValueAsIdno', $pa_options, false);
     $vb_require_value = is_null($pa_element_info['settings']['requireValue']) ? true : (bool) $pa_element_info['settings']['requireValue'];
     if ($vb_treat_value_as_idno || preg_match('![^\\d]+!', $ps_value)) {
         // try to convert idno to item_id
         if ($vn_id = ca_lists::getItemID($pa_element_info['list_id'], $ps_value)) {
             $ps_value = $vn_id;
         }
     }
     if (!$vb_require_value && !(int) $ps_value) {
         return array('value_longtext1' => null, 'item_id' => null);
     }
     if (strlen($ps_value) && !is_numeric($ps_value)) {
         $this->postError(1970, _t('Item_id %2 is not valid for element %1', $pa_element_info["element_code"], $ps_value), 'ListAttributeValue->parseValue()');
         return false;
     }
     $t_item = new ca_list_items((int) $ps_value);
     if (!$t_item->getPrimaryKey()) {
         if ($ps_value) {
             $this->postError(1970, _t('%1 is not a valid list item_id for %2 [%3]', $ps_value, $pa_element_info['displayLabel'], $pa_element_info['element_code']), 'ListAttributeValue->parseValue()');
         } else {
             //$this->postError(1970, _t('Value %1 [%2] cannot be blank', $pa_element_info['displayLabel'], $pa_element_info['element_code']), 'ListAttributeValue->parseValue()');
             return null;
         }
         return false;
     }
     if ((int) $t_item->get('list_id') != (int) $pa_element_info['list_id']) {
         $this->postError(1970, _t('Item is not in the correct list for element %1. List id is %2 but should be %3', $pa_element_info["element_code"], $t_item->get('list_id'), $pa_element_info['list_id']), 'ListAttributeValue->parseValue()');
         return false;
     }
     return array('value_longtext1' => $ps_value, 'item_id' => (int) $ps_value);
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:41,代码来源:ListAttributeValue.php

示例10: getFacetHierarchyAncestorList

 /**
  * Given a item_id (request parameter 'id') returns a list of ancestors for use in the hierarchy browser
  * Returned data is JSON format
  */
 public function getFacetHierarchyAncestorList()
 {
     $pn_id = $this->request->getParameter('id', pInteger);
     $va_access_values = caGetUserAccessValues($this->request);
     $ps_facet_name = $this->request->getParameter('facet', pString);
     $this->view->setVar("facet_name", $ps_facet_name);
     $this->view->setVar("key", $this->request->getParameter('key', pString));
     $ps_browse_type = $this->request->getParameter('browseType', pString);
     if (!($va_browse_info = caGetInfoForBrowseType($ps_browse_type))) {
         // invalid browse type – throw error
         die("Invalid browse type");
     }
     $this->view->setVar("browse_type", $ps_browse_type);
     $vs_class = $va_browse_info['table'];
     $o_browse = caGetBrowseInstance($vs_class);
     if (!is_array($va_facet_info = $o_browse->getInfoForFacet($ps_facet_name))) {
         return null;
     }
     if ($ps_cache_key = $this->request->getParameter('key', pString)) {
         $o_browse->reload($ps_cache_key);
     }
     $va_ancestors = array();
     switch ($va_facet_info['type']) {
         case 'attribute':
             // is it a list attribute?
             $t_element = new ca_metadata_elements();
             if ($t_element->load(array('element_code' => $va_facet_info['element_code']))) {
                 if ($t_element->get('datatype') == 3) {
                     // 3=list
                     if (!$pn_id) {
                         $t_list = new ca_lists();
                         $pn_id = $t_list->getRootListItemID($t_element->get('list_id'));
                     }
                     $t_item = new ca_list_items($pn_id);
                     if ($t_item->getPrimaryKey()) {
                         $vs_primary_key = $t_item->primaryKey();
                         $this->view->setVar("primary_key", $vs_primary_key);
                         $vs_display_fld = $t_item->getLabelDisplayField();
                         $this->view->setVar("display_field", $vs_display_fld);
                         $vs_label_table_name = $t_item->getLabelTableName();
                         $va_ancestors = array_reverse($t_item->getHierarchyAncestors(null, array('includeSelf' => true, 'additionalTableToJoin' => $vs_label_table_name, 'additionalTableJoinType' => 'LEFT', 'additionalTableSelectFields' => array($vs_display_fld, 'locale_id'), 'additionalTableWheres' => array('(' . $vs_label_table_name . '.is_preferred = 1 OR ' . $vs_label_table_name . '.is_preferred IS NULL)'))));
                         array_shift($va_ancestors);
                     }
                 }
             }
             break;
         case 'label':
             // label facet
             $va_facet_info['table'] = $this->ops_tablename;
             // fall through to default case
         // fall through to default case
         default:
             $t_item = $this->request->datamodel->getInstanceByTableName($va_facet_info['table']);
             $t_item->load($pn_id);
             if (method_exists($t_item, "getHierarchyList")) {
                 $va_access_values = caGetUserAccessValues($this->request);
                 $va_facet = $o_browse->getFacet($ps_facet_name, array('sort' => 'name', 'checkAccess' => $va_access_values));
                 $va_hierarchy_list = $t_item->getHierarchyList(true);
                 $vn_hierarchies_in_use = 0;
                 foreach ($va_hierarchy_list as $vn_i => $va_item) {
                     if (isset($va_facet[$va_item[$t_item->primaryKey()]])) {
                         $vn_hierarchies_in_use++;
                         if ($vn_hierarchies_in_use > 1) {
                             break;
                         }
                     }
                 }
             }
             if ($t_item->getPrimaryKey()) {
                 $vs_primary_key = $t_item->primaryKey();
                 $this->view->setVar("primary_key", $vs_primary_key);
                 $vs_display_fld = $t_item->getLabelDisplayField();
                 $this->view->setVar("display_field", $vs_display_fld);
                 $vs_label_table_name = $t_item->getLabelTableName();
                 $va_ancestors = array_reverse($t_item->getHierarchyAncestors(null, array('includeSelf' => true, 'additionalTableToJoin' => $vs_label_table_name, 'additionalTableJoinType' => 'LEFT', 'additionalTableSelectFields' => array($vs_display_fld, 'locale_id'), 'additionalTableWheres' => array('(' . $vs_label_table_name . '.is_preferred = 1 OR ' . $vs_label_table_name . '.is_preferred IS NULL)'))));
             }
             if ($vn_hierarchies_in_use <= 1) {
                 array_shift($va_ancestors);
             }
             break;
     }
     $this->view->setVar('ancestors', $va_ancestors);
     switch ($this->request->getParameter('returnAs', pString)) {
         case "json":
             return $this->render('Browse/facet_hierarchy_ancestors_json.php');
             break;
             # ------------------------------------------------
         # ------------------------------------------------
         case "html":
         default:
             return $this->render('Browse/facet_hierarchy_ancestors_html.php');
             break;
             # ------------------------------------------------
     }
 }
开发者ID:ffarago,项目名称:pawtucket2,代码行数:99,代码来源:FindController.php

示例11: getRootListItemID

 /**
  * Returns item_id of root node for list
  */
 public function getRootListItemID($pm_list_name_or_id = null)
 {
     if ($pm_list_name_or_id) {
         $vn_list_id = $this->_getListID($pm_list_name_or_id);
     } else {
         $vn_list_id = $this->getPrimaryKey();
     }
     if (!$vn_list_id) {
         return null;
     }
     $t_items = new ca_list_items();
     $t_items->load(array('list_id' => $vn_list_id, 'parent_id' => null));
     return $t_items->getPrimaryKey();
 }
开发者ID:ffarago,项目名称:pawtucket2,代码行数:17,代码来源:ca_lists.php

示例12: getTypeInstance

 /**
  * Return ca_list_item instance for the type of the currently loaded row
  */
 public function getTypeInstance($pn_type_id = null)
 {
     if (!isset($this->ATTRIBUTE_TYPE_ID_FLD) || !$this->ATTRIBUTE_TYPE_ID_FLD) {
         return null;
     }
     if ($pn_type_id) {
         $vn_type_id = $pn_type_id;
     } else {
         if (!($vn_type_id = $this->get($this->ATTRIBUTE_TYPE_ID_FLD))) {
             return null;
         }
     }
     $t_list_item = new ca_list_items($vn_type_id);
     return $t_list_item->getPrimaryKey() ? $t_list_item : null;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:18,代码来源:BaseModelWithAttributes.php

示例13: getUIsAsDOM

 public function getUIsAsDOM()
 {
     $t_list = new ca_lists();
     $vo_uis = $this->opo_dom->createElement("userInterfaces");
     $qr_uis = $this->opo_db->query("SELECT * FROM ca_editor_uis ORDER BY ui_id");
     while ($qr_uis->nextRow()) {
         $vo_ui = $this->opo_dom->createElement("userInterface");
         $vs_type = $this->opo_dm->getTableName($qr_uis->get("editor_type"));
         if (strlen($vs_code = $qr_uis->get("editor_code")) > 0) {
             $vo_ui->setAttribute("code", $this->makeIDNO($vs_code));
         } else {
             $vo_ui->setAttribute("code", "standard_{$vs_type}_ui");
         }
         $vo_ui->setAttribute("type", $vs_type);
         $vo_labels = $this->opo_dom->createElement("labels");
         $qr_ui_labels = $this->opo_db->query("SELECT * FROM ca_editor_ui_labels WHERE ui_id=?", $qr_uis->get("ui_id"));
         if ($qr_ui_labels->numRows() > 0) {
             while ($qr_ui_labels->nextRow()) {
                 if ($vs_locale = $this->opt_locale->localeIDToCode($qr_ui_labels->get("locale_id"))) {
                     $vo_label = $this->opo_dom->createElement("label");
                     $vo_label->setAttribute("locale", $vs_locale);
                     $vo_label->appendChild($this->opo_dom->createElement("name", caEscapeForXML($qr_ui_labels->get("name"))));
                     $vo_labels->appendChild($vo_label);
                 }
             }
         } else {
             $vo_label = $this->opo_dom->createElement("label");
             $vo_label->setAttribute("locale", "en_US");
             $vo_label->appendChild($this->opo_dom->createElement("name", caEscapeForXML($vs_code)));
             $vo_labels->appendChild($vo_label);
         }
         $vo_ui->appendChild($vo_labels);
         $vo_screens = $this->opo_dom->createElement("screens");
         $qr_screens = $this->opo_db->query("SELECT * FROM ca_editor_ui_screens WHERE parent_id IS NOT NULL AND ui_id=? ORDER BY screen_id", $qr_uis->get("ui_id"));
         while ($qr_screens->nextRow()) {
             $t_screen = new ca_editor_ui_screens($qr_screens->get("screen_id"));
             $vo_screen = $this->opo_dom->createElement("screen");
             if ($vs_idno = $qr_screens->get("idno")) {
                 $vo_screen->setAttribute("idno", $this->makeIDNO($vs_idno));
             }
             $vo_screen->setAttribute("default", $qr_screens->get("is_default"));
             $vo_labels = $this->opo_dom->createElement("labels");
             $qr_screen_labels = $this->opo_db->query("SELECT * FROM ca_editor_ui_screen_labels WHERE screen_id=?", $qr_screens->get("screen_id"));
             if ($qr_ui_labels->numRows() > 0) {
                 while ($qr_screen_labels->nextRow()) {
                     if ($vs_locale = $this->opt_locale->localeIDToCode($qr_screen_labels->get("locale_id"))) {
                         $vo_label = $this->opo_dom->createElement("label");
                         $vo_label->setAttribute("locale", $vs_locale);
                         $vo_label->appendChild($this->opo_dom->createElement("name", caEscapeForXML($qr_screen_labels->get("name"))));
                         if (strlen(trim($qr_screen_labels->get("description"))) > 0) {
                             $vo_label->appendChild($this->opo_dom->createElement("description", caEscapeForXML($qr_screen_labels->get("description"))));
                         }
                         $vo_labels->appendChild($vo_label);
                     }
                 }
             } else {
                 $vo_label = $this->opo_dom->createElement("label");
                 $vo_label->setAttribute("locale", "en_US");
                 $vo_label->appendChild($this->opo_dom->createElement("name", caEscapeForXML($vs_code)));
                 $vo_labels->appendChild($vo_label);
             }
             $vo_screen->appendChild($vo_labels);
             if (is_array($t_screen->getTypeRestrictions()) && sizeof($t_screen->getTypeRestrictions()) > 0) {
                 $vo_type_restrictions = $this->opo_dom->createElement("typeRestrictions");
                 foreach ($t_screen->getTypeRestrictions() as $va_restriction) {
                     $vo_type_restriction = $this->opo_dom->createElement("restriction");
                     $t_instance = $this->opo_dm->getInstanceByTableNum($va_restriction["table_num"]);
                     $vs_type_code = $t_instance->getTypeListCode();
                     $va_item = $t_list->getItemFromListByItemID($vs_type_code, $va_restriction["type_id"]);
                     $vo_type_restriction->setAttribute("type", $va_item["idno"]);
                     $vo_type_restrictions->appendChild($vo_type_restriction);
                 }
                 $vo_screen->appendChild($vo_type_restrictions);
             }
             $vo_placements = $this->opo_dom->createElement("bundlePlacements");
             $va_placements = $t_screen->getPlacementsInScreen();
             if (is_array($va_placements)) {
                 foreach ($va_placements as $va_placement) {
                     $vo_placement = $this->opo_dom->createElement("placement");
                     $vo_placements->appendChild($vo_placement);
                     $vo_placement->setAttribute("code", $this->makeIDNO($va_placement["placement_code"]));
                     $vo_placement->appendChild($this->opo_dom->createElement("bundle", caEscapeForXML($va_placement["bundle"])));
                     if (is_array($va_placement["settings"])) {
                         $vo_settings = $this->opo_dom->createElement("settings");
                         foreach ($va_placement["settings"] as $vs_setting => $va_values) {
                             if (is_null($va_values)) {
                                 continue;
                             }
                             if (!is_array($va_values)) {
                                 $va_values = array($va_values);
                             }
                             // account for legacy settings
                             if ($vs_setting == "restrict_to_type") {
                                 $vs_setting = "restrict_to_types";
                             }
                             foreach ($va_values as $vs_key => $vs_value) {
                                 switch ($vs_setting) {
                                     case 'restrict_to_types':
                                         $t_item = new ca_list_items($vs_value);
                                         if ($t_item->getPrimaryKey()) {
//.........这里部分代码省略.........
开发者ID:guaykuru,项目名称:pawtucket,代码行数:101,代码来源:ConfigurationExporter.php

示例14: getElementCount

 /**
  * Returns number of elements in system
  *
  * @param $pb_root_elements_only boolean If true, then only root elements are counted; default is false
  * @param $pm_table_name_or_num mixed Optional table name or number to filter list with. If specified then only elements that have a type restriction to the table are counted. If omitted (default) then all elements, regardless of type restrictions, are returned.
  * @param $pm_type_name_or_id mixed Optional type code or type_id to restrict elements to.  If specified then only elements that have a type restriction to the specified table and type are counted. 
  * @return int The number of elements
  */
 public static function getElementCount($pb_root_elements_only = false, $pm_table_name_or_num = null, $pm_type_name_or_id = null)
 {
     $o_dm = Datamodel::load();
     $vn_table_num = $o_dm->getTableNum($pm_table_name_or_num);
     $vo_db = new Db();
     $va_wheres = array();
     if ($pb_root_elements_only) {
         $va_wheres[] = 'cme.parent_id is NULL';
     }
     if ($vn_table_num) {
         $va_wheres[] = 'cmtr.table_num = ?';
         $va_where_params[] = (int) $vn_table_num;
         if ($pm_type_name_or_id) {
             $t_list_item = new ca_list_items();
             if (!is_numeric($pm_type_name_or_id)) {
                 $t_list_item->load(array('idno' => $pm_type_name_or_id));
             } else {
                 $t_list_item->load((int) $pm_type_name_or_id);
             }
             $va_type_ids = array();
             if ($vn_type_id = $t_list_item->getPrimaryKey()) {
                 $va_type_ids[$vn_type_id] = true;
                 if ($qr_children = $t_list_item->getHierarchy($vn_type_id, array())) {
                     while ($qr_children->nextRow()) {
                         $va_type_ids[$qr_children->get('item_id')] = true;
                     }
                 }
                 $va_wheres[] = '((cmtr.type_id = ?) OR (cmtr.include_subtypes = 1 AND cmtr.type_id IN (?)))';
                 $va_where_params[] = (int) $vn_type_id;
                 $va_where_params[] = $va_type_ids;
             }
         }
         $vs_wheres = ' WHERE ' . join(' AND ', $va_wheres);
         $qr_tmp = $vo_db->query("\n\t\t\t\tSELECT count(*) c\n\t\t\t\tFROM ca_metadata_elements cme\n\t\t\t\tINNER JOIN ca_metadata_type_restrictions AS cmtr ON cme.hier_element_id = cmtr.element_id\n\t\t\t\t{$vs_wheres}\n\t\t\t", $va_where_params);
     } else {
         if (sizeof($va_wheres)) {
             $vs_wheres = ' WHERE ' . join(' AND ', $va_wheres);
         } else {
             $vs_wheres = '';
         }
         $qr_tmp = $vo_db->query("\n\t\t\t\tSELECT count(*) c\n\t\t\t\tFROM ca_metadata_elements cme\n\t\t\t\t{$vs_wheres}\n\t\t\t");
     }
     if ($qr_tmp->nextRow()) {
         return $qr_tmp->get('c');
     }
     return 0;
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:55,代码来源:ca_metadata_elements.php

示例15: _parameterRestrictionsApply

 private function _parameterRestrictionsApply($pa_parameters, $ps_controller, $ps_action, $pa_fake_parameters)
 {
     $t_item = new ca_list_items();
     foreach ($pa_parameters as $vs_key => $va_value_data) {
         if ($vs_key == "type" && !is_array($va_value_data) && strlen($va_value_data) > 0) {
             if (!$t_item->load(array("idno" => $va_value_data))) {
                 return false;
             }
             // if there is no explicit type_id parameter we need to figure out the subject with the information we have
             // (which is basically the controller name) and get the type_id by ourselves
             if ($pa_fake_parameters["type_id"]) {
                 $vs_type_id = $pa_fake_parameters["type_id"];
             } else {
                 $vs_type_id = $this->opo_request->getParameter("type_id", pInteger);
             }
             if ($vs_type_id == "") {
                 $vs_table = $this->_convertControllerAndActionToSubjectTable($ps_controller, $ps_action);
                 if ($vs_table) {
                     $t_instance = new $vs_table();
                     if ($pa_fake_parameters[$t_instance->primaryKey()]) {
                         $vn_id = $pa_fake_parameters[$t_instance->primaryKey()];
                     } else {
                         $vn_id = $this->opo_request->getParameter($t_instance->primaryKey(), pInteger);
                     }
                     $t_instance->load($vn_id);
                     if (intval($t_instance->get("type_id")) != intval($t_item->getPrimaryKey())) {
                         return false;
                     }
                 }
             } else {
                 if (intval($t_item->getPrimaryKey()) != intval($vs_type_id)) {
                     return false;
                 }
             }
         } else {
             if (isset($pa_fake_parameters[$vs_key])) {
                 $vs_fake_val = $pa_fake_parameters[$vs_key];
                 if (preg_match("/\\{[a-z_]*\\}/", $vs_fake_val)) {
                     // fake value is placeholder for actual value inserted into forms via JS later -> set some fake actual integer value
                     $vs_fake_val = 1;
                 }
             } else {
                 $vs_fake_val = null;
             }
             if (substr($va_value_data["value"], 0, 1) == "!") {
                 switch ($va_value_data["type"]) {
                     case "int":
                         if (intval(substr($va_value_data["value"], 1)) == intval($vs_fake_val ? $vs_fake_val : $this->opo_request->getParameter($vs_key, pInteger))) {
                             return false;
                         }
                         break;
                     case "float":
                         if (floatval(substr($va_value_data["value"], 1)) == floatval($vs_fake_val ? $vs_fake_val : $this->opo_request->getParameter($vs_key, pFloat))) {
                             return false;
                         }
                         break;
                     default:
                         if (strval(substr($va_value_data["value"], 1)) == strval($vs_fake_val ? $vs_fake_val : $this->opo_request->getParameter($vs_key, pString))) {
                             return false;
                         }
                         break;
                 }
             } else {
                 if ($va_value_data["value"] == "not_set") {
                     if ($this->opo_request->getParameter($vs_key, pInteger) != "" || !is_null($vs_fake_val)) {
                         return false;
                     }
                 } else {
                     switch ($va_value_data["type"]) {
                         case "int":
                             if (intval($va_value_data["value"]) != intval($vs_fake_val ? $vs_fake_val : $this->opo_request->getParameter($vs_key, pInteger))) {
                                 return false;
                             }
                             break;
                         case "float":
                             if (floatval($va_value_data["value"]) != floatval($vs_fake_val ? $vs_fake_val : $this->opo_request->getParameter($vs_key, pFloat))) {
                                 return false;
                             }
                             break;
                         default:
                             if (strval($va_value_data["value"]) != strval($vs_fake_val ? $vs_fake_val : $this->opo_request->getParameter($vs_key, pString))) {
                                 return false;
                             }
                             break;
                     }
                 }
             }
         }
     }
     return true;
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:91,代码来源:AccessRestrictions.php


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