public static function InsertaCumple() { $matr = Trabajadores::model()->findall("cumple=:dato", array(":dato" => date("Y-m-d"))); //solo puede haber un mensaje de onomastico por dia // // // /*echo "<br><br><br><br><br>".count($matr)."<br>"; echo date("Y-m-d").'';*/ $esto = Noticias::model()->find("tiponoticia='02' and aprobado='1' and fecha>=:fechita", array(":fechita" => date("Y-m-d"))); /*var_dump($esto); yii::app()->end();*/ //print_r($matr); //echo gettype($esto); if (count($matr) > 0 and $esto == null) { $cadena = "Feliz cumpleaƱos , el dia de hoy : "; for ($i = 0; $i < count($matr); ++$i) { $cadena = $cadena . $matr[$i]['nombres'] . " " . $matr[$i]['ap'] . " " . $matr[$i]['am'] . " "; } $cadena = $cadena . "\n"; $cadena = $cadena . "Muchas felicidades en este dia ....!"; $mensaje = new Noticias(); $mensaje->txtnoticia = $cadena; $mensaje->iduser = Confignoticias::model()->findBypK(1)->iduseradm; $mensaje->autor = Yii::app()->user->um->loadUserById($mensaje->iduser)->username; $mensaje->tiponoticia = '02'; $mensaje->aprobado = 1; $mensaje->fechapropuesta = date('Y-m-d'); $mensaje->fexpira = date('Y-m-d'); if (!$mensaje->save()) { throw new CHttpException(500, 'NO s peudo grabra el noticin del cumple.'); } } return 1; }
/** * 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 Noticias the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Noticias::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
echo CHtml::link("Configuracion", Yii::app()->baseUrl . "/configuracion"); ?> </span> </li> <li> <span class="summary-icon2"> <img src="<?php echo $baseUrl; ?> /img/lock.png" width="25" height="25" alt="Datos maestros"> </span> <span class="summary-title"> <?php echo CHtml::link("Seguridad", Yii::app()->user->ui->userManagementAdminUrl); ?> </span> </li> <li> <span class="summary-icon2"> <img src="<?php echo $baseUrl; ?> /img/Cluster.png" width="20" height="20" alt="Datos maestros"> </span> <span class="summary-title"> <?php echo CHtml::link("Base de datos", Yii::app()->baseUrl . "/backup"); ?> </span> </li> <li> <span class="summary-icon2"> <img src="<?php