Example #1
0
 /**
  * Returns content for overlay containing details for media attribute
  *
  * Expects the following request parameters: 
  *		value_id = the id of the attribute value (ca_attribute_values) record to display
  *
  *	Optional request parameters:
  *		version = The version of the representation to display. If omitted the display version configured in media_display.conf is used
  *
  */
 public function GetMediaInfo()
 {
     $pn_representation_id = $this->request->getParameter('representation_id', pInteger);
     $pn_value_id = $this->request->getParameter('value_id', pInteger);
     if ($pn_value_id) {
         $t_rep = new ca_object_representations();
         $t_attr_val = new ca_attribute_values($pn_value_id);
         $t_attr = new ca_attributes($t_attr_val->get('attribute_id'));
         $t_subject = $this->opo_datamodel->getInstanceByTableNum($t_attr->get('table_num'), true);
         $t_subject->load($t_attr->get('row_id'));
         $va_rep_display_info = caGetMediaDisplayInfo('media_overlay', $t_attr_val->getMediaInfo('value_blob', 'INPUT', 'MIMETYPE'));
         // check subject_id here
         $va_opts = array('t_attribute_value' => $t_attr_val, 'display' => 'media_overlay', 't_subject' => $t_subject, 'containerID' => 'caMediaPanelContentArea');
         if (strlen($vs_use_book_viewer = $this->request->getParameter('use_book_viewer', pInteger))) {
             $va_opts['use_book_viewer'] = (bool) $vs_use_book_viewer;
         }
         $this->response->addContent(caGetMediaViewerHTMLBundle($this->request, $va_opts));
     } elseif ($pn_representation_id) {
         $t_rep = new ca_object_representations($pn_representation_id);
         $t_subject = new ca_objects($vn_subject_id = $this->request->getParameter('object_id', pInteger));
         if (!$vn_subject_id) {
             if (is_array($va_subject_ids = $t_rep->get($t_subject->tableName() . '.' . $t_subject->primaryKey(), array('returnAsArray' => true))) && sizeof($va_subject_ids)) {
                 $vn_subject_id = array_shift($va_subject_ids);
             } else {
                 $this->postError(1100, _t('Invalid object/representation'), 'ObjectEditorController->GetRepresentationInfo');
                 return;
             }
         }
         $va_opts = array('display' => 'media_overlay', 't_subject' => $t_subject, 't_representation' => $t_rep, 'containerID' => 'caMediaPanelContentArea');
         if (strlen($vs_use_book_viewer = $this->request->getParameter('use_book_viewer', pInteger))) {
             $va_opts['use_book_viewer'] = (bool) $vs_use_book_viewer;
         }
         $this->response->addContent(caGetMediaViewerHTMLBundle($this->request, $va_opts));
     } else {
         //
     }
     //$pn_value_id 	= $this->request->getParameter('value_id', pInteger);
     //$this->response->addContent(caGetMediaViewerHTMLBundle($this->request, array('display' => 'media_overlay', 't_attribute_value' => $pn_value_id, 'containerID' => 'caMediaPanelContentArea')));
 }