Ejemplo n.º 1
0
 /**
  * 
  */
 public function loadBundles()
 {
     list($vn_subject_id, $t_subject) = $this->_initView();
     if (!$this->_checkAccess($t_subject)) {
         return false;
     }
     $ps_bundle_name = $this->request->getParameter("bundle", pString);
     $pn_placement_id = $this->request->getParameter("placement_id", pInteger);
     $pn_start = (int) $this->request->getParameter("start", pInteger);
     if (!($pn_limit = $this->request->getParameter("limit", pInteger))) {
         $pn_limit = null;
     }
     $t_placement = new ca_editor_ui_bundle_placements($pn_placement_id);
     $this->response->addContent(json_encode($t_subject->getBundleFormValues($ps_bundle_name, "{$pn_placement_id}", $t_placement->get('settings'), array('start' => $pn_start, 'limit' => $pn_limit, 'request' => $this->request, 'contentOnly' => true))));
 }
Ejemplo n.º 2
0
 /**
  * Removes bundle placement from display
  *
  * @param int $pn_placement_id Placement_id of placement to remove
  * @param array $pa_options Optional array of options. Supports the following options:
  * 		user_id = if specified then remove will fail if specified user does not have edit access for the display
  * @return bool Returns true on success, false on error
  */
 public function removePlacement($pn_placement_id, $pa_options = null)
 {
     if (!($vn_screen_id = $this->getPrimaryKey())) {
         return null;
     }
     $pn_user_id = isset($pa_options['user_id']) ? $pa_options['user_id'] : null;
     //if ($pn_user_id && !$this->haveAccessToDisplay($pn_user_id, __CA_BUNDLE_DISPLAY_EDIT_ACCESS__)) {
     //	return null;
     //}
     $t_placement = new ca_editor_ui_bundle_placements($pn_placement_id);
     if ($t_placement->getPrimaryKey() && $t_placement->get('screen_id') == $vn_screen_id) {
         $t_placement->setMode(ACCESS_WRITE);
         $t_placement->delete(true);
         if ($t_placement->numErrors()) {
             $this->errors = array_merge($this->errors, $t_placement->errors);
             return false;
         }
         unset(ca_editor_ui_screens::$s_placement_list_cache[$vn_screen_id]);
         return true;
     }
     return false;
 }
Ejemplo n.º 3
0
 /**
  * Returns content for a bundle or the inspector. Used to dynamically and selectively
  * reload an editing form.
  */
 public function reload()
 {
     list($vn_subject_id, $t_subject) = $this->_initView();
     if (!$this->_checkAccess($t_subject)) {
         return false;
     }
     $ps_bundle = $this->request->getParameter("bundle", pString);
     $pn_placement_id = $this->request->getParameter("placement_id", pInteger);
     switch ($ps_bundle) {
         case '__inspector__':
             $this->response->addContent($this->info(array($t_subject->primaryKey() => $vn_subject_id, 'type_id' => $this->request->getParameter("type_id", pInteger))));
             break;
         default:
             $t_placement = new ca_editor_ui_bundle_placements($pn_placement_id);
             if (!$t_placement->getPrimaryKey()) {
                 $this->response->setRedirect($this->request->config->get('error_display_url') . '/n/2580?r=' . urlencode($this->request->getFullUrlPath()));
                 return;
             }
             if ($t_placement->get('bundle_name') != $ps_bundle) {
                 $this->response->setRedirect($this->request->config->get('error_display_url') . '/n/2580?r=' . urlencode($this->request->getFullUrlPath()));
                 return;
             }
             $this->response->addContent($t_subject->getBundleFormHTML($ps_bundle, $pn_placement_id, $t_placement->get('settings'), array('request' => $this->request, 'contentOnly' => true), $vs_label));
             break;
     }
 }