Ejemplo n.º 1
0
 /**
  * Update the CATEGORY collection
  * with new question
  * 
  * @param \Lampcms\Question $Q
  */
 public function addQuestion(\Lampcms\Question $Q)
 {
     $id = $Q->getCategoryId();
     if ($id > 0) {
         $this->ensureIndexes();
         $aLatest = array('qid' => $Q->getResourceId(), 'i_uid' => $Q->getOwnerId(), 'url' => $Q->getSeoUrl(), 'title' => $Q->getTitle(), 'usr' => $Q['username'], 'avtr' => $Q['avtr'], 'ulink' => $Q['ulink']);
         $update = array('$inc' => array('i_qcount' => 1), '$set' => array('i_qid' => $Q->getResourceId(), 'i_ts' => time(), 'hts' => date('F j, Y, g:i a T'), 'a_latest' => $aLatest));
         $this->Mongo->CATEGORY->update(array('id' => $id), $update, array("upsert" => true));
     }
     return $this;
 }