public static function opcionestoolbar($identidad = null, $codocu, $codestado) { $criterio = new CDbCriteria(); $criterio->addcondition(" codocu=:vdocu AND codestado=:vestado AND activo='1' "); $criterio->params = array(":vdocu" => $codocu, ":vestado" => $codestado); $botones = array(); //La matriz depurada a devolver $botones1 = array(); //La matriz depurada a devolver $matriz = Opcionesbarra::model()->findAll($criterio); foreach ($matriz as $row) { $botones[$row->botones->nameop] = $row->action; // $botones1[]=$row->action; ///si se trata de un boton o si se trata de un link con parametros de ID $botones[$row->botones->nameop] = $row->action == '1' ? $row->action : array($row->action, array("id" => $identidad)); } return $botones; }
/** * 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 $id the ID of the model to be loaded * @return Opcionesbarra the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Opcionesbarra::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }