public function run() { if ($sourcetype == '') { $sourcetype = 37; } $connection = yii::app()->db; $tracked_userid = Yii::app()->session['login']['id']; $Criteria = new CDbCriteria(); $Criteria->condition = "upload_sourceid = '" . $this->sourceid . "' AND tracked_userid ='" . $tracked_userid . "'and upload_sourcetype='" . $this->sourcetype . "' and view_status=0 and block_status=0"; $Criteria->order = "note_id DESC"; $note = Notess::model()->findAll($Criteria); foreach ($note as $notes) { $ids[] = $notes->tracker_userid; } $Criteria->join = 'join fn_users as t1 on t1.userid = t.tracker_userid '; $Criteria->join .= 'join fn_contentnote as t2 on t2.id = t.contentnote_id '; $Criteria->addInCondition('t.tracker_userid', $ids); //$Criteria->group = 't.tracker_userid'; $Criteria->select = "t.*,t1.fname,t2.name"; $note = Notess::model()->findAll($Criteria); $content_note = Contentnote::model()->findAll(); //echo $content_note->contentnote_id; //print_r($content_note); /*SELECT t.*,t1.fname FROM `fn_notes` as t join fn_users as t1 on t1.userid = t.tracker_userid WHERE t.`tracker_userid` in (616,115) group by t.`tracker_userid`*/ //echo count($note); $this->render('_note', array('type' => $this->widgettype, 'i' => $this->i, 'sourceid' => $this->sourceid, 'userid' => $this->userid, 'uname' => $this->uname, 'sourcetype' => $this->sourcetype, 'notek' => $note, 'result' => $content_note)); }
public function actionView() { $radioId = Yii::app()->request->getParam("id", 0); $radioName = WapRadioModel::model()->findByPk($radioId)->name; $albumId = WapRadioModel::model()->getAlbumByRadio($radioId, "c2.id"); $radioAvatar = RadioModel::model()->getAvatarUrl($radioId, 's1'); $album = WapAlbumModel::model()->published()->findByPk($albumId); if (!$album) { $this->forward("/site/error", true); } $songsOfAlbum = WapSongModel::model()->getSongsOfAlbum($albumId); $artists = AlbumArtistModel::model()->getArtistsByAlbum($albumId); $phone = yii::app()->user->getState('msisdn'); $errorCode = 'success'; $errorDescription = ''; $registerText = WapAlbumModel::model()->getCustomMetaData('REG_TEXT'); ///meta tag $AlbumDetail = AlbumModel::model()->findByPk($albumId); $artistId = !empty($artists) ? $artists[0]->artist_id : $AlbumDetail->artist_id; $ArtistInfo = ArtistModel::model()->findByPk($artistId); $this->itemName = $AlbumDetail->name; $this->artist = $ArtistInfo->name; $this->thumb = AlbumModel::model()->getAvatarUrl($albumId, 's1'); $this->url = URLHelper::buildFriendlyURL("album", $albumId, Common::makeFriendlyUrl($ArtistInfo->name)); $this->description = strip_tags($AlbumDetail->description); //get other radio $parent_id = Yii::app()->params['horoscope']['parent_id']; $radioListOther = WapRadioModel::model()->getHoroscopes($parent_id); $this->render('detail', array('album' => $album, 'songsOfAlbum' => $songsOfAlbum, 'errorCode' => $errorCode, 'errorDescription' => $errorDescription, 'registerText' => $registerText, 'radioListOther' => $radioListOther, 'radioAvatar' => $radioAvatar)); }
public function beforeSave() { if ($this->isNewRecord) { $this->iduser = yii::app()->user->id; } return parent::beforeSave(); }
public function actionSaveNew() { try { $channelName = Yii::app()->request->getParam('channelName'); $contentType = Yii::app()->request->getParam('contentType'); $channelType = Yii::app()->request->getParam('channelType'); $channelIdentify = Yii::app()->request->getParam('channelIdentify'); $pid = yii::app()->request->getParam('pid'); $list = TSChannel::model()->findAll('Channel_Identify=:channelIdentify', array(':channelIdentify' => $channelIdentify)); if (count($list) >= 1) { $result = array('flag' => 'ERROR', 'message' => '栏目标识符已经存在!'); echo json_encode($result, JSON_UNESCAPED_UNICODE); } else { $model = new TSChannel(); $model->Channel_Pid = $pid; $model->Channel_Is_Title = $contentType; $model->Channel_Is_Parent = $channelType == '0' ? 'true' : 'false'; $model->Channel_Name = $channelName; $model->Channel_Is_Open = 'true'; $model->Channel_Identify = $channelIdentify; $flag = $model->save(); $result = array('flag' => 'SUCCESS', 'message' => '栏目添加成功!', 'newNodes' => array('id' => $model->Id, 'name' => $model->Channel_Name, 'pId' => $model->Channel_Pid, 'isParent' => $model->Channel_Is_Parent, 'open' => $model->Channel_Is_Open)); echo json_encode($result, JSON_UNESCAPED_UNICODE); } } catch (Exception $e) { $result = array('flag' => 'Exception', 'message' => $e->getMessage()); echo json_encode($result, JSON_UNESCAPED_UNICODE); } }
public function hayerrores($codocu) { if (count($_SESSION[self::NOMBRE_SESION][yii::app()->user->id][$codocu]) > 0) { return $_SESSION[self::NOMBRE_SESION][yii::app()->user->id][$codocu]; } return null; }
/** * validate, if its actual user contacts sor actions: * - editableSaver * - ajaxCreate * - delete * @return boolean */ public static function isItSelfContact() { $ppcn_id = false; $action = Yii::app()->controller->action->id; switch (Yii::app()->controller->action->id) { //update case 'editableSaver': $ppcn_id = yii::app()->request->getParam('pk'); //delete //delete case 'delete': if (!$ppcn_id) { $ppcn_id = yii::app()->request->getParam('ppcn_id'); } if (!$ppcn_id) { return false; } $ppcn = PpcnPersonContact::model()->findByPk($ppcn_id); if (!$ppcn || $ppcn->ppcnPprs->pprs_id != Yii::app()->getModule('user')->user()->profile->person_id) { return false; } break; //create //create case 'ajaxCreate': if (yii::app()->request->getParam('value') != Yii::app()->getModule('user')->user()->profile->person_id) { return false; } break; default: return false; break; } return true; }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate($idobservacion) { $model = new Observacionesdetalle(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Observacionesdetalle'])) { $model->attributes = $_POST['Observacionesdetalle']; $model->hidobservaciones = $idobservacion; $model->usuario = Yii::app()->user->name; $model->fecha = date("d-m-Y H:i:s"); if ($model->save()) { $modeloinventario = Observaciones::model()->findByPk($idobservacion); } if (!$this->enviamail($modeloinventario, $model->comentario)) { echo "fallo"; yii::app()->end(); } $model->refresh(); if (!empty($_GET['asDialog'])) { //Close the dialog, reset the iframe and update the grid echo CHtml::script("window.parent.\$('#cru-dialog1').dialog('close');\n\t\t\t\t\t\t\t\t\t\t\t\t\t window.parent.\$('#cru-frame1').attr('src','');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twindow.parent.\$.fn.yiiGridView.update('{$_GET['gridId']}');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"); Yii::app()->end(); } $this->render('Confirma', array('id' => $model->id)); Yii::app()->end(); //$this->redirect(array('view','id'=>$model->id)); } $this->layout = '//layouts/iframe'; $this->render('create', array('model' => $model, 'idobservacion' => $idobservacion)); }
public function saveModel() { if (!$this->save()) { yii::app()->user->setFlash('error', CHtml::errorSummary($this)); return false; } return true; }
public function beforeSave() { if ($this->isNewRecord) { $this->c_estado = '99'; $this->idusertemp = yii::app()->user->id; } return parent::beforeSave(); }
public function actionIndex() { $data = $_REQUEST; $class = new ExternalServices(); $class->data = $data; $class->{$data}['action'](); echo $class->output(); yii::app()->end(); }
public function actionDetial() { $id = yii::app()->request->getParam('id'); $article = TSArticle::model()->findByPk($id); $channel = TSChannel::model()->find('Channel_Identify =:channelIden', array("channelIden" => $article->Channel_Identify)); $this->breadcrumbs = array($channel->Channel_Name => $this->createUrl('show/solutions'), $article->Article_Title); $list = TSArticle::model()->publish()->findAll('Id != :id and Channel_Identify =:ci', array(':id' => $id, ':ci' => $article->Channel_Identify)); $this->render('solutions_detail', array('article' => $article, 'list' => $list)); }
/** * Displays a particular model. * @param integer $id the ID of the model to be displayed */ public function actionView($id) { $model = $this->loadModel($id); if ($model->user_type == 'USER') { $this->render('view', array('model' => $model)); } else { $this->redirect(yii::app()->createUrl('')); } }
public function init() { MyLanguage::setLanguage(); if (empty(Yii::app()->user->id)) { if (!stripos(yii::app()->request->getUrl(), 'login')) { $this->redirect(Yii::app()->createUrl('login/login')); } } }
public function actionCaseDetail() { $id = yii::app()->request->getParam('id'); $article = TSArticle::model()->findByPk($id); $parentChannel = TSChannel::model()->find('Channel_Identify =:pChannelIden', array(':pChannelIden' => $article->Channel_Parent_Identify)); $channel = TSChannel::model()->find('Channel_Identify =:channelIden', array("channelIden" => $article->Channel_Identify)); $this->breadcrumbs = array($parentChannel->Channel_Name => $this->createUrl('show/cases'), $channel->Channel_Name => $this->createUrl('cases/caseForOne', array('id' => $article->Channel_Identify)), $article->Article_Title); $this->render('case_detail', array('article' => $article)); }
public function actionNewDashboard() { $this->layout = '//layouts/dashboard_layout'; Yii::app()->getClientScript()->registerCssFile(yii::app()->request->baseUrl . '/css/newdashboard.css'); if (Yii::app()->user->isGuest) { Yii::app()->user->loginRequired(); } else { $this->render('newdashboard'); } }
/** * @return Google_Client */ private function createClient() { $client = new Google_Client(); $client->setClientId($this->getClientID()); $client->setClientSecret($this->getClientSecret()); $client->setRedirectUri($this->getRedirectUri()); $client->setDeveloperKey($this->getDeveloperKey()); $client->setApplicationName(yii::app()->name); return $client; }
public function actionCaja() { $codigotra = Yii::app()->user->um->getFieldValue(Yii::app()->user->id, 'codtra'); if (is_null($codigotra)) { yii::app()->user->setFlash('notice', " Para usar esta función debes de ser un usuario, registrado como trabajador"); } else { yii::app()->user->setFlash('success', " Tienes código de tabajador " . $codigotra); $this->render("cajamenor", array('codtrabajador' => $codigotra)); } }
public function beforeSave() { if ($this->isNewRecord) { $elusuario = Yii::app()->user->um->LoadUserById(yii::app()->user->id); $sesion_activa = Yii::app()->user->um->findSession($elusuario); $this->idsession = $sesion_activa->idsession; $this->iduser = Yii::app()->user->id; } return parent::beforeSave(); }
public function importadesolpe($iddesolpe, $idcompra) { $modelore = Desolpe::model()->findByPk($iddesolpe); if (!is_null($modelore)) { $this->setAttributes(array('hidguia' => $idcompra, 'codart' => $modelore->codart, 'cant' => $modelore->cant, 'um' => $modelore->um, 'descri' => $modelore->txtmaterial, 'iddesolpe' => $modelore->id, 'cant' => $modelore->cant, 'tipoimputacion' => $modelore->tipimputacion, 'ceco' => $modelore->imputacion, 'codentro' => $modelore->centro, 'codigoalma' => $modelore->codal, 'tipoitem' => $modelore->tipsolpe, 'idusertemp' => yii::app()->user->id, 'coddocu' => '220', 'punit' => 0, 'punitdes' => 0, 'disp' => '12', 'stock' => 0, 'estadodetalle' => '10'), true); $this->setScenario('ingresodesolpe'); return $this->save(); } else { return false; } }
/** * CAction run's method */ public function run() { $key = yii::app()->request->getParam('name'); $tooltip = Yii::app()->request->getParam('value'); if (!$key || !$tooltip) { throw new CHttpException(404, Yii::t('zii', 'Unauthorized request')); } if (!$this->getDbConnection()->createCommand()->update($this->tooltipTable, array('tooltip' => $tooltip), 'tooltip_key=:key', array(':key' => $key))) { $this->getDbConnection()->createCommand()->insert($this->tooltipTable, array('tooltip_key' => $key, 'tooltip' => $tooltip)); } }
public function actionSeleccionaactivo() { $id = $_POST['codiguito']; if (isset($_POST['ajax'])) { echo " es un ajax "; yii::app()->end(); } MiFactoria::trataactivo($id); //echo "salio ".$id; return 1; }
public function run() { /*** get project data ***/ if (yii::app()->user->isVisibleForSuperAdmin()) { $dataProvider = new CActiveDataProvider('Project'); } else { $dataProvider = new CActiveDataProvider('Project', array('data' => yii::app()->user->getProjects())); } /*** render view projectwidget with the dataprovider for project ***/ $this->render('ProjectWidget', array('dataProvider' => $dataProvider)); }
public function init() { if (!$this->data instanceof CModel) { throw new CException('Property "data" should be of CModel class.'); } //set bootstrap css if (yii::app()->editable->form === EditableConfig::FORM_BOOTSTRAP) { $this->htmlOptions = array('class' => 'table table-bordered table-striped table-hover'); } parent::init(); }
protected function beforeSave() { if (parent::beforeSave()) { if ($this->isNewRecord) { $this->sender_date = time(); $this->sender_id = yii::app()->user->id; } return true; } else { return false; } }
public function buscarTipoUser($IdUser) { $conApp = yii::app()->db; $rawData = array(); $sql = "SELECT A.UEMP_ID,A.USU_EMP_ERP UsuarioErp,A.USU_ID,B.USU_NOMBRE,C.ROL_ID,C.ROL_NOMBRE " . "FROM " . $conApp->dbname . ".USUARIO_EMPRESA A " . "INNER JOIN " . $conApp->dbname . ".USUARIO B " . "ON A.USU_ID=B.USU_ID " . "INNER JOIN " . $conApp->dbname . ".ROL C " . "ON A.ROL_ID=C.ROL_ID " . "WHERE A.USU_ID={$IdUser} AND B.USU_EST_LOG=1 "; //echo $sql; //$rawData = $conApp->createCommand($sql)->queryAll(); //Varios registros => $rawData[0]['RazonSocial'] $rawData = $conApp->createCommand($sql)->queryRow(); //Un solo Registro => $rawData['RazonSocial'] $conApp->active = false; return $rawData; }
public function getBackUrl() { $backurl = Yii::app()->getRequest()->getUrlReferrer(); if ($backurl == null || $backurl == yii::app()->getRequest()->getHostInfo() . '/login' || $backurl == yii::app()->getRequest()->getHostInfo() . '/registration') { if (isset($_POST['backurl']) && $_POST['backurl'] != null) { $backurl = $_POST['backurl']; } else { $backurl = yii::app()->getRequest()->getBaseUrl(true); } } return $backurl; }
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model = $this->loadModel($id); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Almacenes'])) { $model->attributes = $_POST['Almacenes']; $model->save(); yii::app()->user->setFlash('success', 'Se modificó el Almacén'); } $this->render('update', array('model' => $model)); }
public static function listMenu() { $list = self::model()->findAll(); $arr = array(); foreach ($list as $value) { if ($value->Visible) { $tmarr = array('label' => $value->DirectoryName, 'url' => yii::app()->createUrl($value->DirectoryLink)); array_push($arr, $tmarr); } } return $arr; }
public static function getPageData($countSql, $sql, $page, $rows) { $easyui = new EasyUIModel(); $count = yii::app()->db->createCommand($countSql)->queryAll(); $count = $count[0]['num'] * 1; $easyui->total = $count; $model = yii::app()->db->createCommand($sql . ' limit :offset, :limit'); $model->bindValue(':offset', ($page - 1) * $rows); $model->bindValue(':limit', $rows * 1); $list = $model->queryAll(); $easyui->rows = $list; return $easyui; }
return $this->_venumModels; } else { return $this->_venumModels; } } private function getNombreremitenteusuario() { if (in_array('VwTrabajadores', $this->enumModels())) { $registro = VwTrabajadores::model()->findByPk(yii::app()->user->um->getFieldValue(Yii::app()->user->id, 'codtra')); if (!is_null($registro)) { return $registro->nombrecompleto; } else { return "";