public function actionSubirImagenMapaChico() { if (Yii::app()->request->isAjaxRequest) { $foroId = $_POST['foroId']; $foroMapIntId = $_POST['foroMapIntId']; $forolevel1 = Forolevel1::model()->find("ForoId={$foroId} AND ForoMapIntId={$foroMapIntId}"); $prefijo = ''; if (isset($_POST['prefijo'])) { $prefijo = $_POST['prefijo']; } $imagen = CUploadedFile::getInstanceByName('imagen'); if (!is_null($imagen)) { $filename = $prefijo . $imagen->name; $forolevel1->ForoMapPat = $filename; if ($forolevel1->update()) { if ($imagen->saveAs(sprintf("../imagesbd/%s", $filename))) { echo $filename; } } } else { echo 0; } } else { throw new CHttpException(404, 'Petición incorrecta.'); } }
public function getUrlForoPequenio() { $criteria = new CDbCriteria(); $criteria->join = ' INNER JOIN foro t2 ON (t2.ForoId = t.ForoId) '; $criteria->addCondition('t.ForoId = :ForoId'); $criteria->addCondition('t.ForoMapIntId = :ForoMapIntId'); $criteria->params = array(':ForoId' => $this->ForoId, ':ForoMapIntId' => $this->ForoMapIntId); $reg = Forolevel1::model()->find($criteria); return isset($reg) ? $reg->ForoMapPat : ''; }
public static function MaxId($ForoId) { $row = Forolevel1::model()->find(array('select' => 'MAX(ForoMapIntId) as maxId', 'condition' => "ForoId=:foro", 'params' => array('foro' => $ForoId))); return $row['maxId']; }