Beispiel #1
0
 public function getArchiveArticles($month, $year)
 {
     $params = Zend_Registry::get('params');
     $select = $this->select();
     $select->where('date >= ?', date('Y-m-d', strtotime($year . '-' . $month . '-01')));
     $select->where('date < ?', date('Y-m-d', strtotime($year . '-' . $month . '-01 + 1 month')));
     $rows = $this->fetchAll($select);
     $articleArray = $rows->toArray();
     $returnArray = array();
     $stripTags = new Zend_Filter_StripTags(array('br'));
     foreach ($articleArray as $article) {
         array_push($returnArray, array('id' => $article['id'], 'title' => $article['title'], 'summary' => $stripTags->filter(Application_Core_Utilities::word_split($article['content'], $params->cms->newsSummaryWordLimit)) . ' &hellip;', 'content' => $article['content'], 'niceDate' => date('M jS, Y', strtotime($article['date'])), 'date' => $article['date']));
     }
     return $returnArray;
 }
 /**
  * Get all testimonials that match any entry in a list of tags
  *
  * @param int testimonialID
  * @return array
  */
 public function getByTags($tagsArray)
 {
     $select = $this->select();
     $select->setIntegrityCheck(false);
     $select->from(array('t' => 'testimonials'), array('id', 'person', 'quote'));
     $select->joinInner(array('ttm' => 'testimonial_tags_map'), 'ttm.testimonial_id = t.id', array());
     $select->joinInner(array('tt' => 'testimonial_tags'), 'tt.id = ttm.testimonial_tag_id', array());
     $select->where('tt.tag = ?', $tagsArray[0]);
     unset($tagsArray[0]);
     foreach ($tagsArray as $tag) {
         $select->orWhere('tt.tag = ?', $tag);
     }
     $select->orWhere('tt.tag = ?', 'global');
     $testimonials = $this->fetchAll($select);
     $returnArray = array();
     foreach ($testimonials as $testimonial) {
         $returnArray[] = array('id' => $testimonial->id, 'person' => $testimonial->person, 'quote' => $testimonial->quote, 'shortQuote' => Application_Core_Utilities::word_split($testimonial->quote, 10) . '&hellip;');
     }
     return $returnArray;
 }