예제 #1
0
 public function getVO()
 {
     if ($this->_vO === null) {
         $VOs = new Default_Model_VOs();
         $VOs->filter->id->equals($this->getVoID());
         if ($VOs->count() > 0) {
             $this->_vO = $VOs->items[0];
         }
     }
     return $this->_vO;
 }
예제 #2
0
 public function fetchAll($filter = null, $format = '', $xmldetailed = false)
 {
     if ($format === "xml") {
         $ores = parent::fetchAll(null);
         $ids = array();
         foreach ($ores as $i) {
             $ids[] = $i->void;
         }
         $res = new Default_Model_VOs();
         $res->filter->id->in($ids);
         if ($filter !== null) {
             $res->filter->chain($filter, "AND");
         }
         $res->filter->orderBy("name");
         $res->refresh("xml", $xmldetailed);
         $ret = $res->items;
         for ($ic = 0; $ic < count($ret); $ic++) {
             $i = $ret[$ic];
             $ii = '<e xmlns:vo="' . RestAPIHelper::XMLNS_VO() . "\" xmlns:discipline=\"" . RestAPIHelper::XMLNS_DISCIPLINE() . "\">{$i}</e>";
             $x = new SimpleXMLElement($ii);
             $x = $x->xpath("//vo:vo");
             $x = $x[0];
             $xid = strval($x->attributes()->id);
             foreach ($ores as $j) {
                 if ($j->void == $xid) {
                     $i = str_replace("<vo:vo ", "<vo:vo relation=\"" . strtolower(str_replace("VO ", "", $j->role)) . "\" ", $i);
                     $ret[$ic] = $i;
                     break;
                 }
             }
         }
         return $ret;
     } else {
         return parent::fetchAll($filter, $format, $xmldetailed);
     }
 }
예제 #3
0
 public function detailsAction()
 {
     trackPage('vo/details');
     $this->_helper->layout->disableLayout();
     $this->view->canEdit = false;
     if ($this->xml !== null) {
         if ($this->_getParam("id") != null) {
             $vos = new Default_Model_VOs();
             $vos->filter->name->ilike($this->_getParam("id"));
             if (file_exists(APPLICATION_PATH . "/../cache/aggvos.xml")) {
                 $xml = new SimpleXMLElement(APPLICATION_PATH . "/../cache/aggvos.xml", 0, true);
             } else {
                 $xml = new SimpleXMLElement($this->xml);
             }
             $volist = $xml->xpath("//VoDump/IDCard[translate(@Name,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')='" . strtoupper($this->_getParam("id")) . "']");
             if (count($volist) > 0) {
                 $voentry = $volist[0];
                 $vo = $this->populateVO($voentry);
                 if ($vos->count() > 0) {
                     if (isset($vos->items[0])) {
                         $vo->id = $vos->items[0]->id;
                         $vo->guid = $vos->items[0]->guid;
                         $vo->sourceid = $vos->items[0]->sourceid;
                     } else {
                         $vo = null;
                     }
                 } else {
                     $vo->id = "";
                     $vo->guid = "";
                     $vo->sourceid = "";
                 }
                 if (isset($vo)) {
                     $vo->contacts = $this->getContacts($this->_getParam("id"));
                 }
                 $this->view->entry = $vo;
                 $this->view->relatedItems = array();
                 $this->view->relatedItems = array_merge($this->view->relatedItems, $vo->applications);
                 $this->view->relatedItems = array_merge($this->view->relatedItems, $vo->sites);
                 $this->view->canEdit = VoAdmin::canEditVOImageList($this->session->userid, $vo);
             }
         }
         $this->view->session = $this->session;
         $this->view->dialogCount = $this->_getParam('dc');
     } else {
         $this->printError();
     }
 }