Esempio n. 1
1
 /**
  * Tests all badges are valid.
  */
 public function testValid()
 {
     $badges = Badge::model()->findAll();
     foreach ($badges as $badge) {
         $this->assertFileExists(Yii::app()->params['badgeIconsDir'] . $badge->location);
     }
 }
 public function actionMy()
 {
     $this->pageTitle = Yii::t('badgerModule.Site', 'My badges');
     $Badge = new Badge();
     $Badge->checkAndGiveOne(Badge::BADGE_LIST_MY);
     $badges = Badge::model()->my()->findAll();
     $this->render('my', array('badges' => $badges));
 }
Esempio n. 3
1
 /**
  * Retrieves all conditions.
  * @return array the conditions
  */
 public function conditions()
 {
     $mapping = $this->getMappings();
     $conditions = array();
     foreach ($mapping as $id => $count) {
         $conditions[] = array('badge' => Badge::model()->findByPk($id), 'count' => $count);
     }
     return $conditions;
 }
Esempio n. 4
0
 public static function getAll()
 {
     $cacheSec = Yii::app()->getModule('badger')->cacheSec;
     $badges = Badge::model()->cache($cacheSec)->findAll();
     return $badges;
 }