Пример #1
0
 protected function addContentInfo($results)
 {
     $results = parent::addContentInfo($results);
     $checkvoted = array();
     try {
         $checkvoted = $this->checkVotedMultiple(array_keys($results));
     } catch (vB_Exception_Api $e) {
         // Ignore for guest user
     }
     //the key of for each node is the nodeid, fortunately
     foreach ($results as $key => &$record) {
         if (!empty($record['options']) and !is_array($record['options'])) {
             $record['options'] = @unserialize($record['options']);
         }
         // Check if the poll is timeout
         if (isset($record['timeout'])) {
             $record['istimeout'] = ($record['timeout'] and $record['timeout'] < vB::getRequest()->getTimeNow());
             // For timeout input
             if ($record['timeout']) {
                 $record['timeoutstr'] = vbdate("m/d/Y H:i", $record['timeout']);
             } else {
                 $record['timeoutstr'] = '';
             }
         } else {
             $record['timeoutstr'] = '';
             $record['istimeout'] = false;
         }
         // Check if it's voted already
         // TODO: we need to improve this to consider voting permissions for guests.
         $record['voted'] = !empty($checkvoted[$key]) ? $checkvoted[$key] : false;
     }
     return $results;
 }