?> <?php echo $form->textField($model, 'bcc', array('id' => 'email-bcc')); ?> </div> <div class="row"> <?php echo $form->label($model, 'subject'); ?> <?php echo $form->textField($model, 'subject'); ?> </div> <div class="row"> <?php $templateList = DocChild::getEmailTemplates(); $templateList = array('0' => Yii::t('docs', 'Custom Message')) + $templateList; // $class = in_array('message',$errors)? 'error':null; echo $form->label($model, 'message'); echo $form->dropDownList($model, 'template', $templateList, array('id' => 'email-template')); // echo $form->error($model,'message'); ?> </div> <div class="row" id="email-message-box"<?php //if($model->template != 0) echo ' style="display:none;"'; ?> > <?php echo $form->textArea($model, 'message', array('id' => 'email-message', 'style' => 'margin:0;padding:0;')); ?> </div>
public function actionViewPage($id) { $model=DocChild::model()->findByPk($id); $this->render('viewTemplate',array( 'model'=>$model, )); }
} // only include visible items } $menuItems = array(); $defaultAction = $isAdmin ? 'admin' : 'index'; foreach ($standardMenuItems as $key => $value) { $file = Yii::app()->file->set('protected/controllers/' . ucfirst($key) . 'Controller.php'); if ($file->exists) { $menuItems[$key] = array('label' => Yii::t('app', $value), 'url' => array("/{$key}/{$defaultAction}"), 'active' => strtolower($module) == strtolower($key) ? true : null); } elseif (is_dir('protected/modules/' . $key)) { if (!is_null($this->getModule())) { $module = $this->getModule()->id; } $menuItems[$key] = array('label' => Yii::t('app', $value), 'url' => array("/{$key}/"), 'active' => strtolower($module) == strtolower($key) ? true : null); } else { $page = DocChild::model()->findByAttributes(array('title' => ucfirst(mb_ereg_replace(':', ':', $key)))); if (isset($page)) { $id = $page->id; $menuItems[$key] = array('label' => ucfirst($value), 'url' => array('/admin/viewPage/' . $id), 'active' => Yii::app()->request->requestUri == Yii::app()->request->baseUrl . '/index.php/admin/viewPage/' . $id ? true : null); } } } if ($isAdmin) { $menuItems['users'] = array('label' => Yii::t('app', 'Users'), 'url' => array('/users/admin'), 'active' => $module == 'users' ? true : null); } } $maxMenuItems = 4; //check if menu has too many items to fit nicely $menuItemCount = count($menuItems); if ($menuItemCount > $maxMenuItems) { $moreMenuItems = array();
public function actionIndex() { // renders the view file 'protected/views/site/index.php' // using the default layout 'protected/views/layouts/main.php' if(Yii::app()->user->isGuest) $this->redirect('index.php/site/login'); else { $profile = CActiveRecord::model('profile')->findByPk(Yii::app()->user->getId()); if(empty($profile->startPage)) { $this->redirect(array('site/whatsNew')); } else { $file = Yii::app()->file->set('protected/controllers/'.ucfirst($profile->startPage).'Controller.php'); if($file->exists) $this->redirect(array(ucfirst($profile->startPage).'/index')); else { $page=DocChild::model()->findByAttributes(array('title'=>ucfirst($key))); if(isset($page)) { $id=$page->id; $menuItems[$key] = array('label' =>ucfirst($value), 'url' => array('/admin/viewPage/'.$id), 'active'=>Yii::app()->request->requestUri==Yii::app()->request->baseUrl.'/index.php/admin/viewPage/'.$id?true:null); } else { $this->redirect(array('site/whatsNew')); } } } } }
public function actionIndex() { // renders the view file 'protected/views/site/index.php' // using the default layout 'protected/views/layouts/main.php' if (Yii::app()->user->isGuest) { $this->redirect('index.php/site/login'); } else { $profile = CActiveRecord::model('profile')->findByPk(Yii::app()->user->getId()); if ($profile->username == 'admin') { $admin =& Yii::app()->params->admin; if (Yii::app()->session['versionCheck'] == false && $admin->updateInterval > -1 && $admin->updateDate + $admin->updateInterval < time()) { Yii::app()->session['alertUpdate'] = true; } else { Yii::app()->session['alertUpdate'] = false; } } else { Yii::app()->session['alertUpdate'] = false; } if (empty($profile->startPage)) { $this->redirect(array('site/whatsNew')); } else { $file = Yii::app()->file->set('protected/controllers/' . ucfirst($profile->startPage) . 'Controller.php'); $module = Yii::app()->file->set('protected/modules/' . $profile->startPage . '/controllers/DefaultController.php'); if ($file->exists || $module->exists) { if ($file->exists) { $this->redirect(array($profile->startPage . '/index')); } if ($module->exists) { $this->redirect(array($profile->startPage . '/default/index')); } } else { $page = DocChild::model()->findByAttributes(array('title' => ucfirst($profile->startPage))); if (isset($page)) { $id = $page->id; $menuItems[$key] = array('label' => ucfirst($value), 'url' => array('/admin/viewPage/' . $id), 'active' => Yii::app()->request->requestUri == Yii::app()->request->baseUrl . '/index.php/admin/viewPage/' . $id ? true : null); } else { $this->redirect(array('site/whatsNew')); } } } } }
public function actionViewPage($id) { $model = DocChild::model()->findByPk($id); if (!isset($model)) { $this->redirect(array('docs/index')); } $this->render('viewTemplate', array('model' => $model)); }