コード例 #1
0
 public static function listaralertasdashboard($model)
 {
     // Obtener ids de contactos
     $contactos_ids = array();
     //        foreach ($model->contactos as $contacto)
     //            $contactos_ids[] = $contacto->id;
     /**
      * Obtener las actividades
      */
     $alertas = array();
     $query = Yii::app()->db->createCommand()->select()->from('alerta')->where(array('and', 'entidad_tipo = :cuenta', 'entidad_id = :entidad_id'), array(':cuenta' => $model->tableName(), ':entidad_id' => $model->id))->orWhere(array('and', 'entidad_tipo = :contacto', array('in', 'entidad_id', $contactos_ids)), array(':contacto' => Contacto::model()->tableName()))->orWhere(array('and', 'entidad_tipo = :tarea', array('in', 'entidad_id', $tareas_ids)), array(':tarea' => Tarea::model()->tableName()))->orWhere(array('and', 'entidad_tipo = :oportunidad', array('in', 'entidad_id', $oportunidades_ids)), array(':oportunidad' => Oportunidad::model()->tableName()))->orWhere(array('and', 'entidad_tipo = :cobranza', array('in', 'entidad_id', $cobranzas_ids)), array(':cobranza' => Cobranza::model()->tableName()))->orWhere(array('and', 'entidad_tipo = :evento', array('in', 'entidad_id', $eventos_ids)), array(':evento' => Evento::model()->tableName()))->orWhere(array('and', 'entidad_tipo = :nota', array('in', 'entidad_id', $notas_ids)), array(':nota' => Nota::model()->tableName()))->order('fecha DESC');
     $alertas = $query->queryAll();
     return $alertas;
 }
コード例 #2
0
ファイル: NotaController.php プロジェクト: jralison/chrono
 public function actionAbrir($id)
 {
     $abrirNota = Nota::model()->findByPk($id);
     $this->render('editarNota', ['nota' => $abrirNota]);
 }
コード例 #3
0
 /**
  * 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 Nota the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Nota::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
コード例 #4
0
 public static function getNo()
 {
     self::model()->updateCounters(array('no_nota' => +1));
     $no = Nota::model()->findByPk(1)->no_nota;
     return $no;
 }