/** * decissions shows the decissions of this or all protocols * * @param int $pid entry-id for protocol * @return string html of the decissions page */ private function decisions($pid) { // pagecaption $this->tpl->assign('pagecaption', parent::lang('class.ProtocolView#page#caption#decisions')); // check rights if (Rights::check_rights($pid, 'protocol', true) || $pid == false) { // prepare template $sD = new JudoIntranetSmarty(); // check pid all or single if ($pid === false) { // get protocol ids $pids = Protocol::return_protocols(); // create protocol objects to sort $protocols = array(); foreach ($pids as $pid) { $protocols[] = new Protocol($pid); } // sort array by protocols date usort($protocols, array($this, 'callback_compare_protocols')); // walk through ids $counter = 0; foreach ($protocols as $protocol) { // assign data $data[$counter] = array('date' => $protocol->get_date('d.m.Y'), 'type' => $protocol->get_type(), 'location' => $protocol->get_location(), 'decisions' => $this->parseHtml($protocol->get_protocol(), '<p class="tmceDecision">|</p>')); // check if protocol has decisions if (count($data[$counter]['decisions']) == 0) { unset($data[$counter]); } $data = array_merge($data); // add to template $sD->assign('data', $data); // increment counter $counter++; } } else { // get protocol object $protocol = new Protocol($pid); // assign data $data[] = array('date' => $protocol->get_date('d.m.Y'), 'type' => $protocol->get_type(), 'location' => $protocol->get_location(), 'decisions' => $this->parseHtml($protocol->get_protocol(), '<p class="tmceDecision">|</p>')); // add to template $sD->assign('data', $data); } // return return $sD->fetch('smarty.protocol.showdecisions.tpl'); } else { // error $errno = $GLOBALS['Error']->error_raised('NotAuthorized', 'entry:' . $this->get('id'), $this->get('id')); $GLOBALS['Error']->handle_error($errno); return $GLOBALS['Error']->to_html($errno); } }