Esempio n. 1
0
 public function loadModel($id)
 {
     $model = Pics::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Esempio n. 2
0
 public function actionAjaxReq()
 {
     $val1 = $_POST['val_id'];
     $tcall = strrpos($val1, ".");
     $criteria = new CDbCriteria();
     $criteria->select = "name,side,ptype,id";
     if ($tcall > 0) {
         $id = (int) substr($val1, 2, $tcall - 2);
         $side = (int) substr($val1, $tcall + 1) + 1;
         $criteria->condition = "bb_id={$id} AND (side=0 OR side={$side})";
     } else {
         $id = (int) $val1;
         $criteria->condition = "bb_id={$id}";
     }
     $rows = Pics::model()->findAll($criteria);
     //		$bb = Bb::model()->findByPk($id);
     $res = "";
     if (!($tcall > 0)) {
         $res .= "<table id=\"gtw\">";
     }
     for ($ii = 0; sizeof($rows) > $ii; $ii++) {
         if (!($tcall > 0)) {
             $res .= "<tr><td>";
         }
         if ($rows[$ii]['ptype'] == 'image') {
             $res .= "<img class=\"resize\" onmouseover=\"pichover(this,event)\" onmouseout=\"picout(this)\" onmousemove=\"picmove(this,event)\" src=\"" . Yii::app()->request->baseUrl . "/images/" . $rows[$ii]['name'] . "\" >";
         } else {
             $res .= "<img class=\"resize\" onmouseover=\"pichover(this,event)\" onmouseout=\"picout(this)\" onmousemove=\"picmove(this,event)\" src=\"//api-maps.yandex.ru/services/constructor/1.0/static/?sid=" . $rows[$ii]['name'] . "\" alt=\"\"/>";
         }
         if (!($tcall > 0)) {
             $res .= "</td><td>" . $rows[$ii]['name'] . "</td>";
             $res .= "<td>[" . $rows[$ii]['side'] . "];" . $rows[$ii]['ptype'] . "</td>";
             $res .= "<td class=\"button-column\">";
             $res .= CHtml::link(CHtml::image(Yii::app()->request->baseUrl . "/css/buts/update.png", "Редактировать"), array("pics/update", "id" => $rows[$ii]['id']), array('title' => 'Редактировать', 'target' => '_blank'));
             $res .= CHtml::link(CHtml::image(Yii::app()->request->baseUrl . "/css/buts/delete.png", "Удалить"), array("pics/delete", "id" => $rows[$ii]['id']), array('class' => 'delete', 'title' => 'Удалить', 'onclick' => 'return confirm("Удаляем картинку?")'));
             $res .= "</td></tr>";
         }
     }
     if (!($tcall > 0)) {
         $res .= "</table>";
     }
     echo $res;
     Yii::app()->end();
 }
Esempio n. 3
0
 public function actionAjaxReq()
 {
     $val1 = $_POST['val_id'];
     $id = (int) substr($val1, 2, strrpos($val1, ".") - 2);
     $side = (int) substr($val1, strrpos($val1, ".") + 1) + 1;
     $criteria = new CDbCriteria();
     $criteria->select = "name,ptype";
     $criteria->condition = "bb_id={$id} AND (side=0 OR side={$side})";
     $rows = Pics::model()->findAll($criteria);
     //		$bb = Bb::model()->findByPk($id);
     $res = "";
     for ($ii = 0; sizeof($rows) > $ii; $ii++) {
         if ($rows[$ii]['ptype'] == 'image') {
             $res .= "<img class=\"resize\" onmouseover=\"pichover(this,event)\" onmouseout=\"picout(this)\" onmousemove=\"picmove(this,event)\" src=\"" . Yii::app()->request->baseUrl . "/images/" . $rows[$ii]['name'] . "\" >";
         } else {
             $res .= "<img class=\"resize\" onmouseover=\"pichover(this,event)\" onmouseout=\"picout(this)\" onmousemove=\"picmove(this,event)\" src=\"//api-maps.yandex.ru/services/constructor/1.0/static/?sid=" . $rows[$ii]['name'] . "\" alt=\"\"/>";
         }
     }
     echo $res;
     Yii::app()->end();
 }