Пример #1
0
 public function filterDisplayData(uiSelectTableRow $row)
 {
     $rowData =& $row->getRowData();
     // needs MemberHelper in the view template
     $rowData['_username'] = link_to_member($rowData['username']);
     $rowData['_lastreview'] = format_date((int) $rowData['ts_lastreview'], rtkLocale::DATE_SHORT);
     return $rowData;
 }
Пример #2
0
 /**
  * Return array of public stories for SharedStories component.
  * 
  * Third parameter indicates which part of the shared stories selection to return:
  * - newest
  * - old (sorted by stars)
  * 
  * @see    study/SharedStoriesComponent
  * 
  * @return array<array>
  */
 public static function getPublicStories($framenum, $keyword, $bNewest)
 {
     coreToolkit::loadHelpers(array('Tag', 'Url', 'Links'));
     $select = self::getInstance()->select(array('stories.userid', 'username', 'stories.framenum', 'lastmodified' => 'DATE_FORMAT(updated_on,\'%e-%c-%Y\')', 'stories.text', 'stars', 'kicks'))->joinLeft('storiesscores', 'stories.framenum=storiesscores.framenum AND stories.userid=storiesscores.authorid')->join('users', 'users.userid=stories.userid')->where('stories.framenum=? AND public!=0', $framenum);
     if ($bNewest) {
         $select->where('updated_on >= DATE_ADD(CURDATE(),INTERVAL -1 MONTH)');
         $select->order('updated_on DESC');
     } else {
         $select->where('updated_on < DATE_ADD(CURDATE(),INTERVAL -1 MONTH)');
         $select->order(array('stars DESC', 'updated_on DESC'));
     }
     //if (!$bNewest) {
     //  echo $select;exit;
     //}
     $rows = self::$db->fetchAll($select);
     foreach ($rows as &$R) {
         // do not show 0's
         if (!$R['stars']) {
             $R['stars'] = '';
         }
         if (!$R['kicks']) {
             $R['kicks'] = '';
         }
         $R['text'] = StoriesPeer::getFormattedStory($R['text'], $keyword);
         $R['author'] = link_to_member($R['username']);
     }
     return $rows;
 }