Пример #1
0
 public function displaySet()
 {
     # --- set info
     $t_set = new ca_sets($pn_set_id = $this->request->getParameter('set_id', pInteger));
     if (!$t_set->getPrimaryKey()) {
         $this->notification->addNotification(_t("This set does not exist"), "message");
         $this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
         return;
     }
     $va_access_values = caGetUserAccessValues($this->request);
     # Enforce access control
     if (sizeof($va_access_values) && !in_array($t_set->get("access"), $va_access_values)) {
         $this->notification->addNotification(_t("This set is not available for view"), "message");
         $this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
         return;
     }
     if (!$t_set->haveAccessToSet($this->request->getUserID(), __CA_SET_READ_ACCESS__)) {
         $this->notification->addNotification(_t("This set is not available for view"), "message");
         $this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
         return;
     }
     $this->view->setVar('t_set', $t_set);
     $va_items = caExtractValuesByUserLocale($t_set->getItems(array('thumbnailVersions' => array('widepreview', 'medium'), 'access' => __CA_SET_READ_ACCESS__, "checkAccess" => $va_access_values, 'user_id' => $this->request->getUserID())));
     $this->view->setVar('items', $va_items);
     $va_row_ids = array();
     foreach ($va_items as $vn_item_id => $va_item_info) {
         $va_row_ids[] = $va_item_info['row_id'];
     }
     # --- all featured sets - for display in right hand column
     // get sets for public display
     $t_list = new ca_lists();
     $vn_public_set_type_id = $t_list->getItemIDFromList('set_types', $t_list->getAppConfig()->get('bristol_set_type'));
     $t_set = new ca_sets($pn_set_id);
     $va_sets = caExtractValuesByUserLocale($t_set->getSets(array('table' => 'ca_objects', 'access' => __CA_SET_READ_ACCESS__, 'setType' => $vn_public_set_type_id, 'user_id' => $this->request->getUserID())));
     $va_set_first_items = array();
     $va_set_first_items = $t_set->getFirstItemsFromSets(array_keys($va_sets), array("version" => "icon", "checkAccess" => $va_access_values));
     $this->view->setVar('sets', $va_sets);
     $this->view->setVar('first_items_from_sets', $va_set_first_items);
     $this->view->setVar('set_title', $t_set->getLabelForDisplay());
     $this->view->setVar('set_description', $t_set->get($this->opo_plugin_config->get('set_description_element_code'), array('convertLinkBreaks' => true)));
     $this->view->setVar('set_creator', $t_set->get('setcreator', array('convertLinkBreaks' => true)));
     $this->view->setVar('set_date', $t_set->get('setdate', array('convertLinkBreaks' => true)));
     $va_exp_dates = $t_set->getAccessExpirationDates($this->request->getUserID(), __CA_SET_READ_ACCESS__, $pn_set_id);
     $this->view->setVar('set_expiration_date', $va_exp_dates[$pn_set_id]);
     // Needed to figure out what result context to use on details
     $this->opo_result_context->setParameter('set_id', $pn_set_id);
     $this->opo_result_context->setResultList($va_row_ids);
     $this->opo_result_context->setAsLastFind();
     $this->opo_result_context->saveContext();
     $this->render($this->ops_theme . '/set_info_html.php');
 }