public function testCreateDeleteSet() { $o_db = new Db(); $qr_objects = $o_db->query('select object_id from ca_objects where deleted=0'); $va_object_ids = $qr_objects->getAllFieldValues('object_id'); //$t = new Timer(); $this->opt_set->addItems($va_object_ids); //var_dump($t->getTime()); $this->assertSame(sizeof($va_object_ids), $this->opt_set->getItemCount()); $this->opt_set->setMode(ACCESS_WRITE); //$t = new Timer(); $this->opt_set->delete(true); //var_dump($t->getTime()); }
public function getParametersForDisplay($pa_rec) { $va_parameters = caUnserializeForDatabase($pa_rec["parameters"]); $va_params = array(); $t_set = new ca_sets($va_parameters['set_id']); $va_params['importing_from'] = array('label' => _t("Applying batch edits to set"), 'value' => $t_set->getLabelForDisplay()); $va_params['number_of_records'] = array('label' => _t("Records to edit"), 'value' => (int) $t_set->getItemCount(array('user_id' => $va_parameters['user_id']))); $t_ui = new ca_editor_uis($va_parameters['ui_id']); $t_screen = new ca_editor_ui_screens(); if ($t_screen->load(array('ui_id' => $t_ui->getPrimaryKey(), 'screen_id' => str_ireplace("screen", "", $va_parameters['screen'])))) { $va_params['ui'] = array('label' => _t("Using interface"), 'value' => $t_ui->getLabelForDisplay() . " ➜ " . $t_screen->getLabelForDisplay()); } return $va_params; }
public function GetItemInfo() { if ($pn_set_id = $this->request->getParameter('set_id', pInteger)) { $t_set = new ca_sets($pn_set_id); if (!$t_set->getPrimaryKey()) { $this->notification->addNotification(_t("The set does not exist"), __NOTIFICATION_TYPE_ERROR__); return; } // does user have edit access to set? if (!$t_set->haveAccessToSet($this->request->getUserID(), __CA_SET_EDIT_ACCESS__, null, array('request' => $this->request))) { $this->notification->addNotification(_t("You cannot edit this set"), __NOTIFICATION_TYPE_ERROR__); $this->Edit(); return; } $pn_table_num = $t_set->get('table_num'); $vn_set_item_count = $t_set->getItemCount(array('user_id' => $this->request->getUserID())); } else { $pn_table_num = $this->request->getParameter('table_num', pInteger); $vn_set_item_count = 0; } $pn_row_id = $this->request->getParameter('row_id', pInteger); $t_row = $this->opo_datamodel->getInstanceByTableNum($pn_table_num, true); if (!$t_row->load($pn_row_id)) { $va_errors[] = _t("Row_id is invalid"); } $this->view->setVar('errors', $va_errors); $this->view->setVar('set_id', $pn_set_id); $this->view->setVar('row_id', $pn_row_id); $this->view->setVar('idno', $t_row->get($t_row->getProperty('ID_NUMBERING_ID_FIELD'))); $this->view->setVar('idno_sort', $t_row->get($t_row->getProperty('ID_NUMBERING_SORT_FIELD'))); $this->view->setVar('set_item_label', $t_row->getLabelForDisplay(false)); if ($vs_template = $this->getRequest()->getParameter('displayTemplate', pString)) { $this->view->setVar('displayTemplate', $t_row->getWithTemplate($vs_template)); } $this->view->setVar('representation_tag', ''); if (method_exists($t_row, 'getRepresentations')) { if ($vn_set_item_count > 50) { $vs_thumbnail_version = 'tiny'; } else { $vs_thumbnail_version = "thumbnail"; } if (sizeof($va_reps = $t_row->getRepresentations(array($vs_thumbnail_version)))) { $va_rep = array_shift($va_reps); $this->view->setVar('representation_tag', $va_rep['tags'][$vs_thumbnail_version]); $this->view->setVar('representation_url', $va_rep['urls'][$vs_thumbnail_version]); $this->view->setVar('representation_width', $va_rep['info'][$vs_thumbnail_version]['WIDTH']); $this->view->setVar('representation_height', $va_rep['info'][$vs_thumbnail_version]['HEIGHT']); } } $this->render('ajax_set_item_info_json.php'); }
<div> <H1><?php print $this->getVar("section_name"); ?> </H1> <?php $o_config = caGetGalleryConfig(); $va_access_values = caGetUserAccessValues($this->request); $va_sets = $this->getVar("sets"); $va_first_items_from_set = $this->getVar("first_items_from_sets"); print "<div class='container'>"; if (is_array($va_sets) && sizeof($va_sets)) { $t_set = new ca_sets(); foreach ($va_sets as $vn_set_id => $va_set) { $t_set->load($vn_set_id); print "<div class='row'>"; print "<div class='col-sm-12 col-sm-offset-0 col-md-6 col-md-offset-3 col-lg-6 col-lg-offset-3'><div class='galleryListItem'>"; $va_first_item = array_shift(array_shift($t_set->getFirstItemsFromSets(array($vn_set_id), array("version" => "small", "checkAccess" => $va_access_values)))); print "<div class='galleryListItemImg'>" . $va_first_item["representation_tag"] . "</div>"; print "<H3>" . $t_set->getLabelForDisplay() . "</H3>"; print "<p class='count'>" . $t_set->getItemCount(array("checkAccess" => $va_access_values)) . " items</p>"; if ($vs_description = $t_set->get($o_config->get('gallery_set_description_element_code'))) { print "<p><strong>" . $vs_description . "</strong></p>"; } print caNavLink($this->request, "<span class='glyphicon glyphicon-th-large'></span>", "", "", "Gallery", $t_set->get("set_id")) . " " . caNavLink($this->request, "<strong>" . _t("VIEW GALLERY") . "</strong>", "", "", "Gallery", $t_set->get("set_id")); print "<div style='clear:both;'></div></div></div></div>\n"; } } print "</div>"; ?> </div>