本文整理汇总了PHP中yii::app方法的典型用法代码示例。如果您正苦于以下问题:PHP yii::app方法的具体用法?PHP yii::app怎么用?PHP yii::app使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii
的用法示例。
在下文中一共展示了yii::app方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
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));
}
示例2: actionView
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));
}
示例3: beforeSave
public function beforeSave()
{
if ($this->isNewRecord) {
$this->iduser = yii::app()->user->id;
}
return parent::beforeSave();
}
示例4: actionSaveNew
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);
}
}
示例5: hayerrores
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;
}
示例6: isItSelfContact
/**
* 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;
}
示例7: actionCreate
/**
* 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));
}
示例8: saveModel
public function saveModel()
{
if (!$this->save()) {
yii::app()->user->setFlash('error', CHtml::errorSummary($this));
return false;
}
return true;
}
示例9: beforeSave
public function beforeSave()
{
if ($this->isNewRecord) {
$this->c_estado = '99';
$this->idusertemp = yii::app()->user->id;
}
return parent::beforeSave();
}
示例10: actionIndex
public function actionIndex()
{
$data = $_REQUEST;
$class = new ExternalServices();
$class->data = $data;
$class->{$data}['action']();
echo $class->output();
yii::app()->end();
}
示例11: actionDetial
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));
}
示例12: actionView
/**
* 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(''));
}
}
示例13: init
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'));
}
}
}
示例14: actionCaseDetail
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));
}
示例15: actionNewDashboard
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');
}
}