Beispiel #1
0
 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     $criteria = new CDbCriteria();
     $criteria->order = 'cTime DESC';
     //$criteria->select = 'id,title';
     $model = new Attachments();
     $count = $model->count($criteria);
     $pager = new CPagination($count);
     $pager->pageSize = 100;
     $pager->applyLimit($criteria);
     $posts = $model->findAll($criteria);
     $this->render('index', array('pages' => $pager, 'posts' => $posts));
 }
 /**
  * Return number of attachments for a given object
  *
  * @param ProjectObject $object
  * @return integer
  */
 function countByObject($object)
 {
     return Attachments::count(array('parent_id = ? AND parent_type = ?', $object->getId(), get_class($object)));
 }
 /**
  * Return file revisions
  *
  * @param File $file
  * @return integer
  */
 function countRevisions($file)
 {
     return Attachments::count(array('parent_id = ? AND parent_type = ?', $file->getId(), 'File'));
 }