예제 #1
0
 /**
  * 用来更新upgradeinfo信息
  * Enter description here ...
  * @param json $response 从服务器得到的需要更新的更新包信息 
  */
 public static function updateUpgradeInfo($response)
 {
     $result = json_decode($response, true);
     $siteInfo = new SiteForm();
     $siteInfo->getSetting();
     if (count($result)) {
         //对每一个需要更新的包
         foreach ($result as $r) {
             $model = new UpgradeInfo();
             $model->versionId = $r['id'];
             if (UpgradeInfo::model()->findByAttributes(array('versionId' => $r['id']))) {
                 continue;
             }
             $model->version = $r['version'];
             $model->name = $r['name'];
             $model->addTime = $r['addTime'];
             $model->description = $r['description'];
             if (UpgradeInfo::compareVersion($siteInfo->version, $model->version) < 0) {
                 $model->save();
             }
         }
     }
 }
예제 #2
0
<div style="margin-top: 40px">

<?php 
$upgradelabel = '系统更新 ';
$upgradeCount = UpgradeInfo::model()->count("status=:status", array(':status' => 'not installed'));
if ($upgradeCount > 0) {
    $upgradelabel .= $this->widget('bootstrap.widgets.TbBadge', array('type' => 'warning', 'label' => $upgradeCount), true);
}
$this->widget('bootstrap.widgets.TbMenu', array('type' => 'list', 'encodeLabel' => false, 'items' => array(array('label' => '系统设置'), array('label' => '网站设置', 'icon' => 'wrench', 'url' => array('setting/site'), 'active' => $this->id === 'setting' and $this->action->id === 'site'), array('label' => $upgradelabel, 'icon' => 'download', 'url' => array('upgradeClient/index'), 'active' => $this->id === 'upgradeClient'), array('label' => '邮箱设置', 'icon' => 'envelope', 'url' => array('setting/mailer'), 'active' => $this->id === 'setting' and $this->action->id === 'mailer'), array('label' => '支付设置', 'icon' => 'shopping-cart', 'url' => array('setting/payment'), 'active' => $this->id === 'setting' and $this->action->id === 'payment'), array('label' => '主题设置', 'icon' => 'picture', 'url' => array('setting/theme'), 'active' => $this->id === 'setting' and $this->action->id === 'theme'), array('label' => '用户管理'), array('label' => '用户管理', 'icon' => 'user', 'url' => array('user/admin'), 'active' => $this->id === 'user'))));
?>
</div>
예제 #3
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = UpgradeInfo::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }