Example #1
0
    public function run()
    {
        $language = strtoupper(Yii::app()->session->offSetGet("FrontLanguage"));
        $datas = Indexpic::model()->findAll('ID>:ID ORDER BY :order ASC ', array(':ID' => 0, ':order' => 'Sorts'));
        $html = "";
        $coltitle = $language . "Title";
        foreach ($datas as $dkel => $dval) {
            $html .= '<li><a target="_blank" href="' . $dval->Link . '"><img src="' . $dval->PicPath . '" width="701" height="257" alt="' . $dval->{$coltitle} . '" /></a></li>';
        }
        echo '<div class="banner smallslider" id="Yii_SlidePic">
					' . $html . '
			  </div>';
        $this->addJs();
    }
Example #2
0
 public function ActionDelPic($ID)
 {
     $ID = intval($ID);
     if (!empty($ID)) {
         // we only allow deletion via POST request
         $model = new Indexpic();
         $imgdir = Indexpic::model()->findByPk($ID)->PicPath;
         if ($imgdir && file_exists($imgdir)) {
             unlink($imgdir);
         }
         if (Indexpic::model()->deleteByPk($ID)) {
             $this->redirect(array('repeatpic'));
         }
     } else {
         throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
     }
 }