Exemplo n.º 1
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.
  */
 public function loadModel()
 {
     if ($this->_model === null) {
         if (isset($_GET['id'])) {
             $this->_model = Datablock::model()->findbyPk($_GET['id']);
         }
         if ($this->_model === null) {
             throw new CHttpException(404, 'The requested page does not exist.');
         }
     }
     return $this->_model;
 }
Exemplo n.º 2
0
 public function actionIndex()
 {
     //$this->redirect( array( 'site/login' ));
     //print_r()
     //print_r( Yii::app()->theme );
     Yii::app()->name = 'iStartPage v0.2 beta';
     Yii::app()->theme = 'istart';
     //Yii::import('application.modules.admin.article');
     //	$article = Yii::app()->getModule('article');
     //	$data = $article::model()->find(1);
     //print_r("<pre>");
     //print_r($inav_list);
     //print_r("</pre>");
     /* how to build navigation from access datablock 'its work prefect!
     		echo "<ul>";
     		$temp_depth = 0;
     		foreach( $inav_list as $nav ){
     			if( $nav['depth'] == 0 ){
     				echo "<li>";echo $nav['name'];
     			}else if( $nav['depth'] > $temp_depth ){
     				echo "<ul>"; echo "<li>"; echo $nav['name'];;
     			}else if( $nav['depth'] < $temp_depth){
     				for($i=0; $i<$temp_depth-$nav['depth']; $i++){
     					echo '</li></ul>';
     				}
     				echo '<li>';echo $nav['name'];
     			}else if( $nav['depth'] == $temp_depth ){
     				echo '</li><li>';echo $nav['name'];			
     			}
     			$temp_depth = $nav['depth'];
     		}
     		for( $i=0; $i<$temp_depth; $i++){
     			echo "</li></ul>";
     		}
     		echo "</ul>";
     		*/
     //$this->render( 'inav', array('inav_list'=>$inav_list) );
     $this->page_navigation = Datablock::model()->iNav(array('label' => 'istart', 'depth' => 0));
     $data = Article::model()->findAll();
     $this->render('index', array('data' => $data));
 }