Пример #1
0
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     Yii::app()->page->title = "Лог по турам";
     if ($this->beginCache("console_log_tours", array('duration' => 3600 * 12))) {
         $listTours = CatLogToursAll::fetchAll(DBQueryParamsClass::CreateParams()->setOrderBy("date2")->setLimit(50)->setCache(0));
         $listToursParams = CatLogToursParams::fetchAll(DBQueryParamsClass::CreateParams()->setOrderBy("date2")->setLimit(50)->setCache(0));
         $rows = "";
         for ($i = 0; $i < sizeof($listTours); $i++) {
             if (!empty($rows)) {
                 $rows .= ",";
             }
             $rows .= "['" . date("d.m", strtotime($listTours[$i]->date2)) . "', " . $listTours[$i]->count . ", " . $listToursParams[$i]->count_category . ", " . $listToursParams[$i]->count_country . " ]";
         }
         $this->render("index", array("rows" => $rows, "listToursParams" => $listToursParams));
         $this->endCache();
     }
 }
Пример #2
0
 static function saveCatLogParams($count_category = 0, $count_country = 0)
 {
     // Сохронякем индивидуальный просмотра категорий
     $check = CatLogToursParams::findByAttributes(array("date2" => date("Y-m-d")));
     if (sizeof($check) > 0) {
         $check[0]->count_category += $count_category;
         $check[0]->count_country += $count_country;
         $check[0]->save();
     } else {
         $check = new CatLogToursParams();
         $check->count_category += $count_category;
         $check->count_country += $count_country;
         $check->date2 = date("Y-m-d");
         if (!$check->save()) {
             print_r($check->getErrors());
         }
     }
 }