protected function renderContent()
 {
     /*$maxOrderNumber = Yii::app()->db->createCommand()
     	  ->select('max(id) as max')
     	  ->from('message_of_day')
     	  ->queryScalar();
     	$msg_id = $maxOrderNumber;*/
     $criteria = new CDbCriteria();
     $criteria->limit = 5;
     $criteria->order = 'id desc';
     $message = MessageOfDay::model()->findAll($criteria);
     if (!empty($message)) {
         foreach ($message as $list) {
             echo CHtml::link($list['message'], array('/messageOfDay/print_message', 'id' => $list['id']), array('id' => 'stud_doc_id2'));
             echo "</br></br>";
         }
     } else {
         echo '<div "id"="stud_doc_id2">';
         echo '</div>';
     }
     //echo CHtml::link('View All',array('/dashboard'),array('id'=>'stud_doc_id1'));
     $config = array('scrolling' => 'no', 'autoDimensions' => false, 'width' => '500', 'height' => '100', 'overlayColor' => '#000', 'padding' => '0', 'showCloseButton' => true, 'onClose' => function () {
         return window . location . reload();
     });
     $this->widget('application.extensions.fancybox.EFancyBox', array('target' => 'a#stud_doc_id2', 'config' => $config));
 }
 /**
  * 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 the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = MessageOfDay::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemple #3
0
<?php
$this->breadcrumbs=array(
	'Dashboard',
);?>

<?php 

$isStudent = Yii::app()->user->getState('stud_id');

$msgOfDay = MessageOfDay::model()->findAll(array('condition'=>'message_of_day_active = 1',
    "order" => "ID DESC",
    "limit" => 3,
));
?>

<div class="wob wob-in-top-threshold wob-0-degrees read-only" style="width: 43%; min-height: 117px;">

<div class="widget">
<div class="widget-header">
  <i class="header-icon"></i>
  <div class="title">Message of the day</div>
</div>
<div class="msg-content">

<?php 
  if(!empty($msgOfDay))
    echo $msgOfDay[0]['message']; 
  else
    echo '<span style="color: red; text-decoration: blink;">No message of the day available !!</span>';
?>
  </div>
<?php

$this->beginContent('//layouts/main');
?>
<div class="container">
	
	<div class="personal-profile-sidebar">
		<?php 
$this->renderPartial('/site/dashboard_sidebar');
?>
	</div>
	<div class="dashboard-content">
		<?php 
$criteria = new CDbCriteria(array('condition' => ':active = t.message_of_day_active', 'params' => array(':active' => 1), 'limit' => 1, 'order' => 'id DESC'));
$message = MessageOfDay::model()->findAll($criteria);
if (!empty($message)) {
    foreach ($message as $list) {
        echo "<marquee width='93.7%' onmouseover=\"this.stop();\" onmouseout=\"this.start();\" height='25px' style='color:white;font-size:16px; padding:5px;border-radius:5px;background: url(\"../images/headerbox.png\") repeat-x scroll 0 0 #3D3D3D;'>" . $list['message'] . "</marquee>";
        echo "</br></br>";
    }
}
?>
		<div id="content">
			<!-- Photo Gallery-->
		<div class="box">
		<div class="box-header">
		<h1>Photo Gallery</h1>
		</div>
		<?php 
$this->Widget('application.extensions.gallery.EGallery', array('path' => Yii::app()->baseUrl . '/images'));
?>