本文整理汇总了PHP中Datamodel::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Datamodel::load方法的具体用法?PHP Datamodel::load怎么用?PHP Datamodel::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Datamodel
的用法示例。
在下文中一共展示了Datamodel::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
*
*/
public function __construct($pm_subject_table_name_or_num, $pn_browse_id = null, $ps_browse_context = '')
{
$this->opo_datamodel = Datamodel::load();
$this->opo_db = new Db();
$this->opa_result_filters = array();
if (is_numeric($pm_subject_table_name_or_num)) {
$this->opn_browse_table_num = intval($pm_subject_table_name_or_num);
$this->ops_browse_table_name = $this->opo_datamodel->getTableName($this->opn_browse_table_num);
} else {
$this->opn_browse_table_num = $this->opo_datamodel->getTableNum($pm_subject_table_name_or_num);
$this->ops_browse_table_name = $pm_subject_table_name_or_num;
}
$this->opo_config = Configuration::load();
$this->opo_ca_browse_config = Configuration::load($this->opo_config->get('browse_config'));
$this->opa_browse_settings = $this->opo_ca_browse_config->getAssoc($this->ops_browse_table_name);
// Add "virtual" search facet - allows one to seed a browse with a search
$this->opa_browse_settings['facets']['_search'] = array('label_singular' => _t('Search'), 'label_plural' => _t('Searches'));
$this->_processBrowseSettings();
$this->opo_ca_browse_cache = new BrowseCache();
if ($pn_browse_id) {
$this->opo_ca_browse_cache->setParameter('table_num', $this->opn_browse_table_num);
$this->opo_ca_browse_cache->load($pn_browse_id);
} else {
$this->opo_ca_browse_cache->setParameter('table_num', $this->opn_browse_table_num);
$this->setContext($ps_browse_context);
}
}
示例2: dispatchLoopShutdown
public function dispatchLoopShutdown()
{
//
// Force output to be sent - we need the client to have the page before
// we start flushing progress bar updates
//
$app = AppController::getInstance();
$req = $app->getRequest();
$resp = $app->getResponse();
$resp->sendResponse();
$resp->clearContent();
//
// Do reindexing
//
if ($req->isLoggedIn() && $req->user->canDoAction('can_do_search_reindex')) {
set_time_limit(3600 * 8);
$o_db = new Db();
$t_timer = new Timer();
$o_dm = Datamodel::load();
$va_table_names = $o_dm->getTableNames();
$vn_tc = 0;
foreach ($va_table_names as $vs_table) {
if ($o_instance = $o_dm->getInstanceByTableName($vs_table)) {
if ($o_instance->isHierarchical()) {
if (!$o_instance->rebuildAllHierarchicalIndexes()) {
$o_instance->rebuildHierarchicalIndex();
}
}
caIncrementHierachicalReindexProgress(_t('Rebuilding hierarchical index for %1', $o_instance->getProperty('NAME_PLURAL')), $t_timer->getTime(2), memory_get_usage(true), $va_table_names, $o_instance->tableNum(), $o_instance->getProperty('NAME_PLURAL'), $vn_tc + 1);
}
$vn_tc++;
}
caIncrementHierachicalReindexProgress(_t('Index rebuild complete!'), $t_timer->getTime(2), memory_get_usage(true), $va_table_names, null, null, sizeof($va_table_names));
}
}
示例3: __construct
public function __construct($po_request)
{
parent::__construct($po_request);
$this->opo_dm = Datamodel::load();
$t_list = new ca_lists();
$this->opn_victim_type_id = $t_list->getItemIDFromList('entity_types', 'victim');
}
示例4: Get
public function Get($pa_additional_query_params = null, $pa_options = null)
{
$ps_query = $this->request->getParameter('q', pString);
$ps_bundle = $this->request->getParameter('bundle', pString);
$va_tmp = explode('.', $ps_bundle);
$vs_table = $va_tmp[0];
$vs_field = $va_tmp[1];
$o_dm = Datamodel::load();
if (!($t_table = $o_dm->getInstanceByTableName($vs_table, true))) {
// bad table name
print _t("Invalid table name");
return null;
}
if (!$t_table->hasField($vs_field) || !in_array($t_table->getFieldInfo($vs_field, 'FIELD_TYPE'), array(FT_TEXT, FT_NUMBER))) {
// bad field name
print _t("Invalid bundle name");
return null;
}
if ($this->request->user->getBundleAccessLevel($vs_table, $vs_field) == __CA_BUNDLE_ACCESS_NONE__) {
print _t("You do not have access to this bundle");
return null;
}
$vn_max_returned_values = 50;
$o_db = new Db();
$qr_res = $o_db->query("\n\t\t\t\tSELECT DISTINCT {$vs_field}\n\t\t\t\tFROM {$vs_table}\n\t\t\t\tWHERE\n\t\t\t\t\t({$vs_field} LIKE ?) " . ($t_table->hasField('deleted') ? ' AND deleted = 0' : '') . "\n\t\t\t\tORDER BY\n\t\t\t\t\t{$vs_field}\n\t\t\t\tLIMIT {$vn_max_returned_values}\n\t\t\t", (string) $ps_query . '%');
$this->view->setVar('intrinsic_value_list', $qr_res->getAllFieldValues($vs_field));
return $this->render('ajax_intrinsic_value_list_html.php');
}
示例5: __construct
public function __construct($ps_widget_path, $pa_settings)
{
$this->title = _t('Records by status');
$this->description = _t('Displays objects or authority items by cataloguing status');
parent::__construct($ps_widget_path, $pa_settings);
$this->opo_config = Configuration::load($ps_widget_path . '/conf/recordsByStatus.conf');
$this->opo_datamodel = Datamodel::load();
# -- get status values
$t_lists = new ca_lists();
$va_statuses = caExtractValuesByUserLocale($t_lists->getItemsForList("workflow_statuses"));
$va_status_info = array();
$va_status_values = array();
foreach ($va_statuses as $i => $va_info) {
$va_status_info[$va_info["item_value"]] = $va_info["name_singular"];
$va_status_values[] = $va_info["item_value"];
}
$this->opa_status_display_names = $va_status_info;
$this->opa_status_values = $va_status_values;
$this->opa_table_display_names = array('ca_objects' => _t('Objects'), 'ca_entities' => _t('Entities'), 'ca_places' => _t('Places'), 'ca_occurrences' => _t('Occurrences'), 'ca_sets' => _t('Sets'), 'ca_collections' => _t('Collections'), 'ca_object_representations' => _t('Object representations'), 'ca_object_lots' => _t('Object lots'));
foreach ($this->opa_table_display_names as $vs_table => $vs_display) {
if (!$this->getRequest() || !$this->getRequest()->user->canDoAction("can_use_records_by_status_widget_{$vs_table}")) {
foreach (BaseWidget::$s_widget_settings['recordsByStatusWidget']["display_type"]["options"] as $vs_setting_display => $vs_setting_table) {
if ($vs_setting_table == $vs_table) {
unset(BaseWidget::$s_widget_settings['recordsByStatusWidget']["display_type"]["options"][$vs_setting_display]);
}
}
}
}
}
示例6: __construct
public function __construct($po_request, $ps_table = "")
{
$this->opo_request = $po_request;
$this->ops_table = $ps_table;
$this->opo_dm = Datamodel::load();
$this->opa_errors = array();
$this->ops_method = $this->opo_request->getRequestMethod();
if (!in_array($this->ops_method, array("PUT", "DELETE", "GET", "OPTIONS"))) {
$this->addError("Invalid HTTP request method");
}
$this->opn_id = $this->opo_request->getParameter("id", pString);
// we allow for a string to support fetching by idno; typically it's a numeric id
$vs_post_data = $this->opo_request->getRawPostData();
if (strlen(trim($vs_post_data)) > 0) {
$this->opa_post = json_decode($vs_post_data, true);
if (!is_array($this->opa_post)) {
$this->addError(_t("Data sent via POST doesn't seem to be in JSON format"));
}
} else {
if ($vs_post_data = $this->opo_request->getParameter('source', pString)) {
$this->opa_post = json_decode($vs_post_data, true);
if (!is_array($this->opa_post)) {
$this->addError(_t("Data sent via 'source' parameter doesn't seem to be in JSON format"));
}
} else {
$this->opa_post = array();
}
}
$this->opa_valid_tables = array("ca_objects", "ca_object_lots", "ca_entities", "ca_places", "ca_occurrences", "ca_collections", "ca_list_items", "ca_lists", "ca_object_representations", "ca_storage_locations", "ca_movements", "ca_loans", "ca_tours", "ca_tour_stops", "ca_sets");
if (strlen($ps_table) > 0) {
if (!in_array($ps_table, $this->opa_valid_tables)) {
$this->addError(_t("Table does not exist"));
}
}
}
示例7: Info
/**
*
*/
public function Info()
{
$o_dm = Datamodel::load();
$t_form = new ca_search_forms();
$this->view->setVar('form_count', $t_form->getFormCount(array('user_id' => $this->request->getUserID(), 'access' => __CA_SEARCH_FORM_EDIT_ACCESS__)));
return $this->render('widget_search_form_info_html.php', true);
}
示例8: load
/**
*
*
* @param string $ps_cache_key
* @param array $pa_options Options include:
* removeDeletedItems = remove any items in the cache that are currently marked as deleted [Default=true]
*
* @return bool
*/
public function load($ps_cache_key, $pa_options = null)
{
if (ExternalCache::contains($ps_cache_key, 'Browse')) {
$this->opa_browse = ExternalCache::fetch($ps_cache_key, 'Browse');
$this->ops_cache_key = $ps_cache_key;
if (caGetOption('removeDeletedItems', $pa_options, true)) {
$o_dm = Datamodel::load();
if (($t_instance = $o_dm->getInstanceByTableNum($this->opa_browse['params']['table_num'], true)) && $t_instance->hasField('deleted')) {
// check if there are any deleted items in the cache
if (is_array($va_ids = $this->opa_browse['results']) && sizeof($va_ids)) {
$vs_pk = $t_instance->primaryKey();
$qr_deleted = $t_instance->getDb()->query($x = "\n\t\t\t\t\t\t\tSELECT {$vs_pk} FROM " . $t_instance->tableName() . " WHERE {$vs_pk} IN (?) AND deleted = 1\n\t\t\t\t\t\t", array($va_ids));
if ($qr_deleted->numRows() > 0) {
$va_deleted_ids = $qr_deleted->getAllFieldValues($vs_pk);
foreach ($va_deleted_ids as $vn_deleted_id) {
if (($vn_i = array_search($vn_deleted_id, $va_ids)) !== false) {
unset($va_ids[$vn_i]);
}
}
$this->opa_browse['results'] = array_values($va_ids);
}
}
}
}
return true;
}
return false;
}
示例9: Info
/**
*
*/
public function Info()
{
$o_dm = Datamodel::load();
$t_display = new ca_bundle_displays($vn_display_id = $this->_getDisplayID());
$this->view->setVar('bundle_displays', caExtractValuesByUserLocale($t_display->getBundleDisplays(array('user_id' => $this->request->getUserID(), 'access' => __CA_BUNDLE_DISPLAY_EDIT_ACCESS__)), null, array()));
return $this->render('widget_bundle_display_info_html.php', true);
}
示例10: __construct
public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
{
parent::__construct($po_request, $po_response, $pa_view_paths);
$this->opo_datamodel = Datamodel::load();
$this->opo_app_plugin_manager = new ApplicationPluginManager();
$this->opo_result_context = new ResultContext($po_request, $this->ops_table_name, ResultContext::getLastFind($po_request, $this->ops_table_name));
}
示例11: __construct
public function __construct($pa_hits, $pn_table_num)
{
$this->opo_datamodel = Datamodel::load();
$this->opn_subject_tablenum = $pn_table_num;
$this->ops_subject_pk = $this->opo_datamodel->getTablePrimaryKeyName($pn_table_num);
$this->setHits($pa_hits);
}
示例12: setPrimaryTable
protected function setPrimaryTable($ps_table)
{
$o_dm = Datamodel::load();
if (!$o_dm->tableExists($ps_table)) {
$this->assertTrue(false, 'Invalid table ' . $ps_table);
}
$this->ops_primary_table = $ps_table;
}
示例13: __construct
public function __construct($ps_widget_path, $pa_settings)
{
$this->title = _t('Recent changes');
$this->description = _t('Lists recent changes to objects or authority items');
parent::__construct($ps_widget_path, $pa_settings);
$this->opo_config = Configuration::load($ps_widget_path . '/conf/recentChangesWidget.conf');
$this->opo_datamodel = Datamodel::load();
}
示例14: __construct
public function __construct($m_table = '', $ps_field_name)
{
$this->opo_config = Configuration::load();
$this->opo_datamodel = Datamodel::load();
if ($m_table && $ps_field_name) {
$this->loadSettings($m_table, $ps_field_name);
}
}
示例15: __construct
public function __construct($ps_table)
{
$o_dm = Datamodel::load();
$this->ops_tablename = $ps_table;
$this->opn_tablenum = $o_dm->getTableNum($ps_table);
$this->ops_primary_key = $o_dm->getTablePrimaryKeyName($ps_table);
parent::__construct();
}