本文整理汇总了PHP中ca_objects::tableNum方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_objects::tableNum方法的具体用法?PHP ca_objects::tableNum怎么用?PHP ca_objects::tableNum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_objects
的用法示例。
在下文中一共展示了ca_objects::tableNum方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
{
$this->ops_theme = __CA_THEME__;
// get current theme
if (!is_dir(__CA_APP_DIR__ . '/plugins/NovaMuse/themes/' . $this->ops_theme . '/views')) {
// if theme is not defined for this plugin, try to use "default" theme
$this->ops_theme = 'default';
}
parent::__construct($po_request, $po_response, array(__CA_APP_DIR__ . '/plugins/NovaMuse/themes/' . $this->ops_theme . '/views'));
$this->opo_plugin_config = Configuration::load($this->request->getAppConfig()->get('application_plugins') . '/NovaMuse/conf/NovaMuse.conf');
if (!(bool) $this->opo_plugin_config->get('enabled')) {
die(_t('NovaMuse plugin is not enabled'));
}
MetaTagManager::addLink('stylesheet', $po_request->getBaseUrlPath() . "/app/plugins/NovaMuse/themes/" . $this->ops_theme . "/css/dashboard.css", 'text/css');
$this->opo_result_context = new ResultContext($po_request, 'ca_objects', 'dashboard');
$t_list = new ca_lists();
$this->opn_member_institution_id = $t_list->getItemIDFromList('entity_types', 'member_institution');
$this->opn_individual_id = $t_list->getItemIDFromList('entity_types', 'ind');
$this->opn_family_id = $t_list->getItemIDFromList('entity_types', 'fam');
$this->opn_organization_id = $t_list->getItemIDFromList('entity_types', 'org');
$t_object = new ca_objects();
$this->opn_objectTableNum = $t_object->tableNum();
$va_access_values = caGetUserAccessValues($this->request);
$this->opa_access_values = $va_access_values;
$this->view->setVar('access_values', $va_access_values);
}
示例2: setUp
public function setUp()
{
$t_list = new ca_lists();
// add a minimal object for testing
$va_object_types = $t_list->getItemsForList('object_types', array('idsOnly' => true, 'enabledOnly' => true));
$t_object = new ca_objects();
$t_object->setMode(ACCESS_WRITE);
$t_object->set('type_id', array_shift($va_object_types));
$t_object->insert();
$this->opn_object_id = $t_object->getPrimaryKey();
$this->assertGreaterThan(0, $this->opn_object_id, 'Object should have a primary key after insert');
// add minimal set
$va_set_types = $t_list->getItemsForList('set_types', array('idsOnly' => true, 'enabledOnly' => true));
$t_set = new ca_sets();
$t_set->setMode(ACCESS_WRITE);
$t_set->set('type_id', array_shift($va_set_types));
$t_set->set('table_num', $t_object->tableNum());
$t_set->insert();
$this->opn_set_id = $t_set->getPrimaryKey();
$this->assertGreaterThan(0, $this->opn_set_id, 'Set should have a primary key after insert');
}
示例3: renumberObjects
/**
*
*
* @return boolean
*/
public function renumberObjects($po_application_plugin_manager = null)
{
if (!$this->getPrimaryKey()) {
return false;
}
if ($va_non_conforming_objects = $this->getObjectsWithNonConformingIdnos()) {
$va_objects = $this->getObjects();
$vs_lot_num = $this->get('idno_stub');
$t_object = new ca_objects();
$vb_web_set_transaction = false;
if (!$this->inTransaction()) {
$o_trans = new Transaction($this->getDb());
$vb_web_set_transaction = true;
} else {
$o_trans = $this->getTransaction();
}
$t_object->setTransaction($o_trans);
$t_idno = $t_object->getIDNoPlugInInstance();
$vs_separator = $t_idno->getSeparator();
$vn_i = 1;
foreach ($va_objects as $vn_object_id => $va_object_info) {
if ($t_object->load($vn_object_id)) {
if ($po_application_plugin_manager) {
$po_application_plugin_manager->hookBeforeSaveItem(array('id' => $vn_object_id, 'table_num' => $t_object->tableNum(), 'table_name' => $t_object->tableName(), 'instance' => $t_object));
}
$t_object->setMode(ACCESS_WRITE);
$t_object->set('idno', $vs_lot_num . $vs_separator . $vn_i);
$t_object->update();
if ($t_object->numErrors()) {
$t->rollback();
$this->errors = $t_object->errors;
return false;
}
if ($po_application_plugin_manager) {
$po_application_plugin_manager->hookSaveItem(array('id' => $vn_object_id, 'table_num' => $t_object->tableNum(), 'table_name' => $t_object->tableName(), 'instance' => $t_object));
}
$vn_i++;
}
}
if ($vb_web_set_transaction) {
$o_trans->commit();
}
}
return true;
}
示例4: AjaxAddItem
public function AjaxAddItem()
{
if (!$this->request->isLoggedIn()) {
$this->response->setRedirect(caNavUrl($this->request, '', 'LoginReg', 'loginForm'));
return;
}
global $g_ui_locale_id;
// current locale_id for user
$va_errors = array();
$o_purifier = new HTMLPurifier();
# --- set_id is passed through form, otherwise we're saving a new set, and adding the item to it
if ($this->request->getParameter('set_id', pInteger)) {
$t_set = $this->_getSet(__CA_EDIT_READ_ACCESS__);
if (!$t_set && ($t_set = $this->_getSet(__CA_SET_READ_ACCESS__))) {
$va_errors["general"] = _t("You can not add items to this lightbox. You have read only access.");
$this->view->setVar('errors', $va_errors);
$this->addItemForm();
return;
}
} else {
$t_set = new ca_sets();
# --- set name - if not sent, make a decent default
$ps_name = $o_purifier->purify($this->request->getParameter('name', pString));
if (!$ps_name) {
$ps_name = _t("Your lightbox");
}
# --- set description - optional
$ps_description = $o_purifier->purify($this->request->getParameter('description', pString));
$t_list = new ca_lists();
$vn_set_type_user = $t_list->getItemIDFromList('set_types', $this->request->config->get('user_set_type'));
$t_object = new ca_objects();
$vn_object_table_num = $t_object->tableNum();
$t_set->setMode(ACCESS_WRITE);
$t_set->set('access', 1);
#$t_set->set('access', $this->request->getParameter('access', pInteger));
$t_set->set('table_num', $vn_object_table_num);
$t_set->set('type_id', $vn_set_type_user);
$t_set->set('user_id', $this->request->getUserID());
$t_set->set('set_code', $this->request->getUserID() . '_' . time());
# --- create new attribute
if ($ps_description) {
$t_set->addAttribute(array('description' => $ps_description, 'locale_id' => $g_ui_locale_id), 'description');
}
$t_set->insert();
if ($t_set->numErrors()) {
$va_errors["general"] = join("; ", $t_set->getErrors());
$this->view->setVar('errors', $va_errors);
$this->addItemForm();
return;
} else {
# --- save name - add new label
$t_set->addLabel(array('name' => $ps_name), $g_ui_locale_id, null, true);
# --- select the current set
$this->request->user->setVar('current_set_id', $t_set->get("set_id"));
}
}
if ($t_set) {
$pn_item_id = null;
$pn_object_id = $this->request->getParameter('object_id', pInteger);
if ($pn_object_id) {
if (!$t_set->isInSet("ca_objects", $pn_object_id, $t_set->get("set_id"))) {
if ($pn_item_id = $t_set->addItem($pn_object_id, array(), $this->request->getUserID())) {
//
// Select primary representation
//
$t_object = new ca_objects($pn_object_id);
$vn_rep_id = $t_object->getPrimaryRepresentationID();
// get representation_id for primary
$t_item = new ca_set_items($pn_item_id);
$t_item->addSelectedRepresentation($vn_rep_id);
// flag as selected in item vars
$t_item->update();
$va_errors = array();
$this->view->setVar('message', _t("Successfully added item."));
$this->render("Form/reload_html.php");
} else {
$va_errors["message"] = _t('Could not add item to lightbox');
$this->render("Form/reload_html.php");
}
} else {
$this->view->setVar('message', _t("Item already in lightbox."));
$this->render("Form/reload_html.php");
}
} else {
$this->view->setVar('message', _t("Object ID is not defined"));
$this->render("Form/reload_html.php");
}
}
}
示例5: unlike
/**
* Remove all likes from object (for one user)
* @param array $pa_data
* @return bool
*/
protected function unlike($pa_data)
{
if (!is_array($pa_data) || !isset($pa_data['object_id']) || !isset($pa_data['entity_id'])) {
$this->addError("Malformed request body");
return false;
}
$vn_object_id = (int) $pa_data['object_id'];
$t_object = new ca_objects($vn_object_id);
if (!$t_object->getPrimaryKey()) {
$this->addError("Invalid object id");
return false;
}
$vn_entity_id = (int) $pa_data['entity_id'];
$t_entity = new ca_entities($vn_entity_id);
if (!$t_entity->getPrimaryKey()) {
$this->addError("Invalid entity id");
return false;
}
$o_db = new Db();
$qr_likes = $o_db->query("\n\t\t\tDELETE FROM ca_item_comments WHERE name = ? AND table_num = ? AND row_id = ?\n\t\t", $vn_entity_id, $t_object->tableNum(), $t_object->getPrimaryKey());
if (!$qr_likes) {
$this->addError('something may have went wrong');
return false;
}
return array('msg' => 'like(s) successfully removed');
}
示例6: testGetAttributeCount
public function testGetAttributeCount()
{
$t_element = ca_attributes::getElementInstance('internal_notes');
$this->opt_object->getDb()->dieOnError(true);
$this->assertEquals(2, ca_attributes::getAttributeCount($this->opt_object->getDb(), $this->opt_object->tableNum(), $this->opt_object->getPrimaryKey(), $t_element->getPrimaryKey()));
}
示例7: importMediaFromDirectory
/**
* @param array $pa_options
* progressCallback =
* reportCallback =
* sendMail =
*/
public static function importMediaFromDirectory($po_request, $pa_options = null)
{
global $g_ui_locale_id;
$t_object = new ca_objects();
$o_eventlog = new Eventlog();
$t_set = new ca_sets();
$va_notices = $va_errors = array();
$vb_we_set_transaction = false;
$o_trans = isset($pa_options['transaction']) && $pa_options['transaction'] ? $pa_options['transaction'] : null;
if (!$o_trans) {
$vb_we_set_transaction = true;
$o_trans = new Transaction();
}
$o_log = new Batchlog(array('user_id' => $po_request->getUserID(), 'batch_type' => 'MI', 'table_num' => (int) $t_object->tableNum(), 'notes' => '', 'transaction' => $o_trans));
if (!is_dir($pa_options['importFromDirectory'])) {
$o_eventlog->log(array("CODE" => 'ERR', "SOURCE" => "mediaImport", "MESSAGE" => "Specified import directory is invalid"));
return null;
}
$vs_batch_media_import_root_directory = $po_request->config->get('batch_media_import_root_directory');
if (!preg_match("!^{$vs_batch_media_import_root_directory}!", $pa_options['importFromDirectory'])) {
$o_eventlog->log(array("CODE" => 'ERR', "SOURCE" => "mediaImport", "MESSAGE" => "Specified import directory is invalid"));
return null;
}
if (preg_match("!/\\.\\.!", $vs_directory) || preg_match("!\\.\\./!", $pa_options['importFromDirectory'])) {
$o_eventlog->log(array("CODE" => 'ERR', "SOURCE" => "mediaImport", "MESSAGE" => "Specified import directory is invalid"));
return null;
}
$vb_include_subdirectories = (bool) $pa_options['includeSubDirectories'];
$vb_delete_media_on_import = (bool) $pa_options['deleteMediaOnImport'];
$vs_import_mode = $pa_options['importMode'];
$vs_match_mode = $pa_options['matchMode'];
$vn_object_type_id = $pa_options['ca_objects_type_id'];
$vn_rep_type_id = $pa_options['ca_object_representations_type_id'];
$vn_object_access = $pa_options['ca_objects_access'];
$vn_object_representation_access = $pa_options['ca_object_representations_access'];
$vn_object_status = $pa_options['ca_objects_status'];
$vn_object_representation_status = $pa_options['ca_object_representations_status'];
$vs_idno_mode = $pa_options['idnoMode'];
$vs_idno = $pa_options['idno'];
$vs_set_mode = $pa_options['setMode'];
$vs_set_create_name = $pa_options['setCreateName'];
$vn_set_id = $pa_options['set_id'];
$vn_locale_id = $pa_options['locale_id'];
$vs_skip_file_list = $pa_options['skipFileList'];
$va_relationship_type_id_for = array();
if (is_array($va_create_relationship_for = $pa_options['create_relationship_for'])) {
foreach ($va_create_relationship_for as $vs_rel_table) {
$va_relationship_type_id_for[$vs_rel_table] = $pa_options['relationship_type_id_for_' . $vs_rel_table];
}
}
if (!$vn_locale_id) {
$vn_locale_id = $g_ui_locale_id;
}
$va_files_to_process = caGetDirectoryContentsAsList($pa_options['importFromDirectory'], $vb_include_subdirectories);
if ($vs_set_mode == 'add') {
$t_set->load($vn_set_id);
} else {
if ($vs_set_mode == 'create' && $vs_set_create_name) {
$va_set_ids = $t_set->getSets(array('user_id' => $po_request->getUserID(), 'table' => 'ca_objects', 'access' => __CA_SET_EDIT_ACCESS__, 'setIDsOnly' => true, 'name' => $vs_set_create_name));
$vn_set_id = null;
if (is_array($va_set_ids) && sizeof($va_set_ids) > 0) {
$vn_possible_set_id = array_shift($va_set_ids);
if ($t_set->load($vn_possible_set_id)) {
$vn_set_id = $t_set->getPrimaryKey();
}
} else {
$vs_set_code = mb_substr(preg_replace("![^A-Za-z0-9_\\-]+!", "_", $vs_set_create_name), 0, 100);
if ($t_set->load(array('set_code' => $vs_set_code))) {
$vn_set_id = $t_set->getPrimaryKey();
}
}
if (!$t_set->getPrimaryKey()) {
$t_set->setMode(ACCESS_WRITE);
$t_set->set('user_id', $po_request->getUserID());
$t_set->set('type_id', $po_request->config->get('ca_sets_default_type'));
$t_set->set('table_num', $t_object->tableNum());
$t_set->set('set_code', $vs_set_code);
$t_set->insert();
if ($t_set->numErrors()) {
$va_notices['create_set'] = array('idno' => '', 'label' => _t('Create set %1', $vs_set_create_name), 'message' => _t('Failed to create set %1: %2', $vs_set_create_name, join("; ", $t_set->getErrors())), 'status' => 'SET ERROR');
} else {
$t_set->addLabel(array('name' => $vs_set_create_name), $vn_locale_id, null, true);
if ($t_set->numErrors()) {
$va_notices['add_set_label'] = array('idno' => '', 'label' => _t('Add label to set %1', $vs_set_create_name), 'message' => _t('Failed to add label to set: %1', join("; ", $t_set->getErrors())), 'status' => 'SET ERROR');
}
$vn_set_id = $t_set->getPrimaryKey();
}
}
} else {
$vn_set_id = null;
// no set
}
}
if ($t_set->getPrimaryKey() && !$t_set->haveAccessToSet($po_request->getUserID(), __CA_SET_EDIT_ACCESS__)) {
//.........这里部分代码省略.........
示例8: Index
/**
* Generates a form for specification of media import settings. The form is rendered into the current view, inherited from ActionController
*
* @param array $pa_values An optional array of values to preset in the format, overriding any existing values in the model of the record being editing.
* @param array $pa_options Array of options passed through to _initView
*
*/
public function Index($pa_values = null, $pa_options = null)
{
AssetLoadManager::register("directoryBrowser");
list($t_ui) = $this->_initView($pa_options);
$this->view->setVar('batch_mediaimport_last_settings', $va_last_settings = is_array($va_last_settings = $this->request->user->getVar('batch_mediaimport_last_settings')) ? $va_last_settings : array());
// get import type from request
$vs_import_target = $this->getRequest()->getParameter('target', pString);
$t_instance = $this->getRequest()->getAppDatamodel()->getInstance($vs_import_target);
// if that failed, try last settings
if (!$t_instance) {
$vs_import_target = $va_last_settings['importTarget'];
$t_instance = $this->getRequest()->getAppDatamodel()->getInstance($vs_import_target);
}
// if that too failed, go back to objects
if (!$t_instance) {
$t_instance = new ca_objects();
$vs_import_target = 'ca_objects';
}
$this->getView()->setVar('import_target', $vs_import_target);
$t_instance->set('status', $va_last_settings[$vs_import_target . '_status']);
$t_instance->set('access', $va_last_settings[$vs_import_target . '_access']);
$t_rep = new ca_object_representations();
$t_rep->set('status', $va_last_settings['ca_object_representations_status']);
$t_rep->set('access', $va_last_settings['ca_object_representations_access']);
$va_nav = $t_ui->getScreensAsNavConfigFragment($this->request, null, $this->request->getModulePath(), $this->request->getController(), $this->request->getAction(), array(), array());
if (!$this->request->getActionExtra() || !isset($va_nav['fragment'][str_replace("Screen", "screen_", $this->request->getActionExtra())])) {
$this->request->setActionExtra($va_nav['defaultScreen']);
}
$this->view->setVar('t_ui', $t_ui);
$this->view->setVar('import_target', caHTMLSelect('import_target', $this->opa_importable_tables, array('id' => 'caImportTargetSelect', 'onchange' => 'window.location.replace("' . caNavUrl($this->getRequest(), $this->getRequest()->getModulePath(), $this->getRequest()->getController(), $this->getRequest()->getAction()) . '/target/" + jQuery("#caImportTargetSelect").val()); return false;'), array('value' => $vs_import_target)));
$this->view->setVar('import_mode', caHTMLSelect('import_mode', array(_t('Import all media, matching with existing records where possible') => 'TRY_TO_MATCH', _t('Import only media that can be matched with existing records') => 'ALWAYS_MATCH', _t('Import all media, creating new records for each') => 'DONT_MATCH'), array(), array('value' => $va_last_settings['importMode'])));
$this->view->setVar('match_mode', caHTMLSelect('match_mode', array(_t('Match using file name') => 'FILE_NAME', _t('Match using directory name') => 'DIRECTORY_NAME', _t('Match using directory name, then file name') => 'FILE_AND_DIRECTORY_NAMES'), array(), array('value' => $va_last_settings['matchMode'])));
$this->view->setVar('match_type', caHTMLSelect('match_type', array(_t('matches exactly') => 'EXACT', _t('starts with') => 'STARTS', _t('ends with') => 'ENDS', _t('contains') => 'CONTAINS'), array(), array('value' => $va_last_settings['matchType'])));
$this->view->setVar($vs_import_target . '_type_list', $t_instance->getTypeListAsHTMLFormElement($vs_import_target . '_type_id', null, array('value' => $va_last_settings[$vs_import_target . '_type_id'])));
$this->view->setVar($vs_import_target . '_limit_to_types_list', $t_instance->getTypeListAsHTMLFormElement($vs_import_target . '_limit_matching_to_type_ids[]', array('multiple' => 1), array('height' => '100px', 'values' => $va_last_settings[$vs_import_target . '_limit_matching_to_type_ids'])));
$this->view->setVar('ca_object_representations_type_list', $t_rep->getTypeListAsHTMLFormElement('ca_object_representations_type_id', null, array('value' => $va_last_settings['ca_object_representations_type_id'])));
if ($vs_import_target != 'ca_objects') {
// non-object representations have relationship types
$t_rel = ca_relationship_types::getRelationshipTypeInstance($t_instance->tableName(), 'ca_object_representations');
$this->getView()->setVar($vs_import_target . '_representation_relationship_type', $t_rel->getRelationshipTypesAsHTMLSelect('ltor', null, null, array('name' => $vs_import_target . '_representation_relationship_type'), array('value' => $va_last_settings[$vs_import_target . '_representation_relationship_type'])));
}
$va_importer_list = ca_data_importers::getImporters(null, array('formats' => array('exif')));
$va_object_importer_options = $va_object_representation_importer_options = array("-" => '');
foreach ($va_importer_list as $vn_importer_id => $va_importer_info) {
if ($va_importer_info['table_num'] == $t_instance->tableNum()) {
// target table
$va_object_importer_options[$va_importer_info['label']] = $vn_importer_id;
} else {
$va_object_representation_importer_options[$va_importer_info['label']] = $vn_importer_id;
}
}
$this->view->setVar($vs_import_target . '_mapping_list', caHTMLSelect($vs_import_target . '_mapping_id', $va_object_importer_options, array(), array('value' => $va_last_settings[$vs_import_target . '_mapping_id'])));
$this->view->setVar($vs_import_target . '_mapping_list_count', sizeof($va_object_importer_options));
$this->view->setVar('ca_object_representations_mapping_list', caHTMLSelect('ca_object_representations_mapping_id', $va_object_representation_importer_options, array(), array('value' => $va_last_settings['ca_object_representations_mapping_id'])));
$this->view->setVar('ca_object_representations_mapping_list_count', sizeof($va_object_representation_importer_options));
//
// Available sets
//
$t_set = new ca_sets();
$va_available_set_list = caExtractValuesByUserLocale($t_set->getSets(array('table' => $vs_import_target, 'user_id' => $this->request->getUserID(), 'access' => __CA_SET_EDIT_ACCESS__, 'omitCounts' => true)));
$va_available_sets = array();
foreach ($va_available_set_list as $vn_set_id => $va_set) {
$va_available_sets[$va_set['name']] = $vn_set_id;
}
$this->view->setVar('available_sets', $va_available_sets);
$this->view->setVar('t_instance', $t_instance);
$this->view->setVar('t_rep', $t_rep);
$this->render('mediaimport/import_options_html.php');
}