public function actionIndex() { if (isset($_GET['id'])) { $model = News::model()->findByPk($_GET['id']); $model_photo = Photo::model()->getPhotoByAlbum($_GET['id']); //print_r($model_photo); $this->render('detail', array('model' => $model, 'model_photo' => $model_photo)); } else { if ($_GET['type_id']) { $criteria = new CDbCriteria(); $criteria->select = '*'; $criteria->condition = 'status = 1 AND news_type_id=' . $_GET['type_id']; $criteria->order = "create_date desc,news_id desc"; $total = News::model()->count($criteria); $pages = new CPagination($total); $pages->setPageSize(20); $pages->applyLimit($criteria); $model = News::model()->findAll($criteria); $type = NewsType::model()->findByPk($_GET['type_id']); $this->render('index', array('model' => $model, 'type' => $type, 'pages' => $pages)); } else { if ($_GET['group']) { $criteria = new CDbCriteria(); $criteria->select = '*'; $criteria->condition = 'status = 1 AND (news_type_id <> 2 AND news_type_id <> 3) AND news_group_id=' . $_GET['group']; $criteria->order = "create_date desc,news_id desc"; $total = News::model()->count($criteria); $pages = new CPagination($total); $pages->setPageSize(20); $pages->applyLimit($criteria); $model = News::model()->findAll($criteria); $group = NewsGroup::model()->findByPk($_GET['group']); $this->render('index', array('model' => $model, 'group' => $group, 'pages' => $pages)); } else { $news_criteria = new CDbCriteria(); $news_criteria->condition = "status = 1 AND (news_type_id <> 2 AND news_type_id <> 3)"; $news_criteria->order = "create_date desc,news_id desc"; $news_total = News::model()->count($news_criteria); $pages = new CPagination($news_total); $pages->setPageSize(10); $pages->applyLimit($news_criteria); $model = News::model()->findAll($news_criteria); $this->render('index', array('model' => $model, 'pages' => $pages)); } } } }
<?php /* * *************** these fields are required *********************************** */ //die(); //var_dump($MyModules); $id = 0; $message = ''; $data['module_Title'] = 'Category'; $data['message'] = ''; $obj = new NewsType(); $allowed_module = array('About'); if (isset($_GET['_Id'])) { $id = $_GET['_Id']; $data['_data'] = $obj->getByID($id); if (!in_array($data['_data'][$obj->getPrefix() . 'module'], $allowed_module)) { //$data['_data'][$obj->getPrefix().'module']!='about'&&$data['_data'][$obj->getPrefix().'module']!='syllabus') return; } } else { forceRedirect(ADMIN_URL); return; //$data['_data'] = $obj->get('', $obj->getPrefix().'uin' . ' desc'); //$data['list_fields'] = $obj->getListField(); } //$data['_extraModule'] = array(array('Commitments', 'Commit&action=Commitlist')); $data['prefix'] = $obj->getPrefix(); $field_list = array('detail'); $_data = $obj->getByID($id); //$data['obj']=$obj; $data['lists'] = $obj->getListField(); $upload_dir = UPLOADS_DIR . $obj->getUploadURL();
<?php //$page='News'; $objCat = new NewsType(); $Cat = $objCat->getByModuleName('about'); //var_dump($Cat); $data = array(); $data['title'] = $Cat['news01title']; $data['data'] = $Cat; echo defaultModule($strModuleName, $data);
<?php //var_dump( get_browser()); $id = getREQUEST('_Id'); if (!$id) { $url = getSiteLink('home'); //echo $url; forceRedirect($url); } $objCat = new NewsType(); $obj = new News(); $objHitCounter = new HitCounter(); $ip = $_SERVER['REMOTE_ADDR']; $list = $obj->getById($id); if ($objHitCounter->CheckHitsByIpPost($ip, $id)) { //echo 'voila'; $objHitCounter->insert(array('news02uin' => $id, 'ip_add' => $ip, 'agent' => $_SERVER['HTTP_USER_AGENT'])); //echo $id; $totHits = $list['news02hits']; $totHits++; $obj->setFieldValues('hits', $totHits); $obj->update_core($id); } //$page='News'; //echo ($list->rowCount()); //var_dump($list); $Cat = $objCat->getById($list['news02news01uin']); $data['title'] = $Cat['news01title']; $data['catid'] = $Cat['news01uin']; $data['data'] = $list; echo defaultModule($strModuleName, $data);
<?php //forceRedirect('?module=Commit'); ?> <div class="headline">Dashboard </div> <?php $ObjnewsType = new NewsType(); $menudata = $ObjnewsType->get(array('backend' => '1')); //var_dump($menudata); ?> <?php foreach ($menudata as $row) { ?> <div class="gallery_box1 "> <?php if ($row[$ObjnewsType->getPrefix() . 'url'] != 1) { ?> <a href="home.php?module=<?php echo $row[$ObjnewsType->getPrefix() . 'url']; ?> "> <img src="../uploads/newstype/thumb/<?php if (isset($row['news01file']) && $row['news01file'] != '') { echo $row['news01file']; } else { echo 'noicon.png'; } ?>
<?php /***************** these fields are required ************************************/ //die(); //var_dump($MyModules); $id = 0; $Type = getREQUEST('Type'); $message = ''; $data['message'] = ''; if (!$Type) { forceRedirect('home.php'); } $obj = new News(); $objCat = new NewsType(); $newsType = $objCat->getById($Type); $data['module_Title'] = $newsType['news01title']; if (isset($_GET['_Id'])) { $id = $_GET['_Id']; $data['_data'] = $obj->getByID($id); } else { $data['_data'] = $obj->get(array('news01uin' => $Type)); $data['list_fields'] = $obj->getListField(); } //$data['_extraModule'] = array(array('Commitments', 'Commit&action=Commitlist')); $data['prefix'] = $obj->getPrefix(); $field_list = $obj->getUpdateFields(); $_data = $obj->getByID($id); //$data['obj']=$obj; $data['lists'] = $obj->getListField(); $upload_dir = UPLOADS_DIR . $obj->getUploadURL(); $data['upload_dir'] = $upload_dir;
<?php //$page='News'; $objCat = new NewsType(); $Cat = $objCat->getByModuleName('syllabus'); //var_dump($Cat); $data = array(); $data['title'] = $Cat['news01title']; $data['data'] = $Cat; echo defaultModule($strModuleName, $data);
<?php //$page='News'; $objCat = new NewsType(); $Cat = $objCat->getByModuleName('donation'); //var_dump($Cat); $data = array(); $data['title'] = $Cat['news01title']; $data['data'] = $Cat; echo defaultModule($strModuleName, $data);
<?php /* * *************** these fields are required *********************************** */ //die(); //var_dump($MyModules); $id = 0; $message = ''; $data['module_Title'] = 'Super settings'; $data['message'] = ''; $obj = new NewsType(); if (isset($_GET['_Id'])) { $id = $_GET['_Id']; $data['_data'] = $obj->getByID($id); } else { $data['_data'] = $obj->get('', $obj->getPrefix() . 'backend desc ,' . $obj->getPrefix() . 'sortOrder asc'); $data['list_fields'] = $obj->getListField(); } //$data['_extraModule'] = array(array('Commitments', 'Commit&action=Commitlist')); $data['prefix'] = $obj->getPrefix(); $field_list = $obj->getUpdateFields(); $_data = $obj->getByID($id); //$data['obj']=$obj; $data['lists'] = $obj->getListField(); $upload_dir = UPLOADS_DIR . $obj->getUploadURL(); $data['upload_dir'] = $upload_dir; $data['uploadUrl'] = '../uploads/' . $obj->getUploadURL(); /* * *************** END of these fields are required *********************************** */ /** * $fields_post :: This list is the list of all fields which are affected while inserting in database * */ /**
<?php //$page='News'; $objCat = new NewsType(); $Cat = $objCat->getByModuleName('mfp'); //var_dump($Cat); $data = array(); $data['title'] = $Cat['news01title']; $data['data'] = $Cat; echo defaultModule($strModuleName, $data);
<?php //$SQL='select COUNT(*) as rowCount from news02news where news02uin>0 '; ///$data=Query($SQL); //$page='News'; //$objCat= new NewsType(); $obj = new NewsType(); $objNews = new News(); $activity_type = $obj->getByModuleName('activity'); //var_dump($activity_type); $activity = $objNews->getByType($activity_type['news01uin'], 1, 1); //var_dump($activity); $plan = $obj->getByModuleName('plans'); $donation = $obj->getByModuleName('donation'); //var_dump($donation); //var_dump($activity); if (!empty($activity)) { $list['activity'] = clipMyText($activity[0]['news02detail'], 500); } else { $list['activity'] = ''; } $list['plan'] = clipMyText($plan['news01detail'], 500); $list['donation'] = clipMyText($donation['news01detail'], 200); //echo ($list->rowCount()); //var_dump($list); //$Cat=$objCat->getById($id); $data['title'] = "ताजा खबर"; $data['data'] = $list; //var_dump($data); //$data['tot_page']=ceil(($list->rowCount())/NEWS_PER_PAGE); //echo $list->rowCount();
function getSubModule($module) { if (substr($module, 0, strlen('adversitse')) == 'adversitse') { include_once TPL . 'includes/ad' . substr($module, -1) . '.php'; return; } elseif ($module == 'frompaper') { include_once TPL . 'includes/from_paper.php'; return; } $objType = new NewsType(); $cat_datas = $objType->getByModuleName($module); if ($cat_datas->rowCount() < 1) { return; } $cat_data = ''; $id = 0; foreach ($cat_datas as $row) { $id = $row['news01uin']; $cat_data = $row; } $objNews = new News(); $data = $objNews->getByType($id, 1, 5); //$data1=$objNews->getByType($id,2,5); $prefix = 'news02'; ?> <header class="heading"> <a href="<?php echo getSiteLink('News', '', '', $cat_data['news01' . 'uin'], $cat_data['news01' . 'title']); ?> " class="more">बाँकी अंश</a> <h2><?php echo $cat_data['news01' . 'title']; ?> </h2> </header> </header> <div class="content-holder"> <?php $lists = ''; ?> <?php $ct = 0; foreach ($data as $row) { ?> <?php if ($ct < 2) { ?> <article class="photo-news"> <img src="uploads/news/<?php echo $row['news02file']; ?> " alt="img1"> <h3><a href="<?php echo getSiteLink('NewsArticle', '', $row[$prefix . 'title'], $row[$prefix . 'uin']); ?> "><?php echo $row['news02title']; ?> </a></h3> <p><?php $shortTry = substr($row['news02shortDesc'], 0, 300); echo substr($shortTry, 0, strrpos($shortTry, ' ', -1)); ?> </article> <?php } else { ?> <?php $lists .= '<li><a href="' . getSiteLink('NewsArticle', '', $row[$prefix . 'title'], $row[$prefix . 'uin']) . '">' . $row['news02title'] . '</a></li>'; ?> <?php } ?> <?php $ct++; } ?> <?php echo '<ul>' . $lists . '</ul>'; ?> </div> <?php }
function BuildMenu($parentId, $ParentName = '') { //$menu=''; $ObjMenu = new NewsType(); $MenuPrefix = $ObjMenu->getPrefix(); $_result = $ObjMenu->get(array('parent' => $parentId, 'menu' => 0)); //var_dump($_result); $_class = ''; if (count($_result) < 1) { return; } else { //var_dump(count($_result)); } $ulclass = '"" '; $exAttr = ''; if ($parentId < 1) { $ulclass = 'nav navbar-nav'; } else { $ulclass = 'dropdown-menu'; $exAttr = 'role="menu"'; } // echo '<ul class="' . $ulclass . '" ' . $exAttr . '>'; foreach ($_result as $menuItem) { //var_dump($menuItem); $class = ''; if (isset($_GET['page'])) { $curr_module = substr($_GET['page'], 0, strlen($menuItem[$MenuPrefix . 'module'])); //echo $curr_module.$menuItem[$MenuPrefix.'module']; } else { $curr_module = 'home'; } if (strtolower($curr_module) == strtolower($menuItem[$MenuPrefix . 'module'])) { $class = 'active'; } if ($class != '') { //echo $curr_module; } //echo $class; //var_dump($_row); $url = ''; if ($menuItem[$MenuPrefix . 'url'] == "0" || $menuItem[$MenuPrefix . 'url'] == '') { $url = ''; } elseif ($menuItem[$MenuPrefix . 'hasChild'] == '0') { $url = $menuItem[$MenuPrefix . 'module']; } elseif ($menuItem[$MenuPrefix . 'url'] == 1) { $url = 'ActivityList'; } elseif ($menuItem[$MenuPrefix . 'url']) { $url = $menuItem[$MenuPrefix . 'url']; } $exAttr = ''; if ($menuItem[$MenuPrefix . 'hasChild']) { $class .= ' dropdown'; $exAttr = 'class = "dropdown-toggle" data-toggle="dropdown"'; } //if($parentId>0) echo '<li class="' . $class . '" >'; echo '<a ' . $exAttr . ' href="'; if ($url == 'ActivityList') { echo getSiteLink($url, '', '', $menuItem[$MenuPrefix . 'uin'], $menuItem[$MenuPrefix . 'title']); } else { echo getSiteLink($url, ''); //echo getSiteLink($url,'',$menuItem[$MenuPrefix,'uin'],$menuItem[$MenuPrefix.'title']); } echo '" title="' . $menuItem[$MenuPrefix . 'title' . $_SESSION['lang_type']] . '">'; if ($menuItem[$MenuPrefix . 'module'] == 'home') { echo '<span class="fa fa-home fa-fw"></span>'; } else { echo $menuItem[$MenuPrefix . 'title' . $_SESSION['lang_type']]; if ($menuItem[$MenuPrefix . 'hasChild'] == 1) { echo '<span class="caret"></span>'; } } echo '</a>'; //$objSub= new NewsType(); if ($menuItem[$MenuPrefix . 'hasChild']) { $datasubMenu = $ObjMenu->getByParent($menuItem[$MenuPrefix . 'uin']); if (count($datasubMenu) > 0) { //echo $menuItem[$MenuPrefix.'uin'].' '.$menuItem[$MenuPrefix.'module']; BuildMenu($menuItem[$MenuPrefix . 'uin'], $menuItem[$MenuPrefix . 'module']); } } echo '</li>'; } echo '</ul>'; //return $menu; }
<?php //$page='News'; $objCat = new NewsType(); $Cat = $objCat->getByModuleName('plans'); //var_dump($Cat); $data = array(); $data['title'] = $Cat['news01title']; $data['data'] = $Cat; echo defaultModule($strModuleName, $data);
<?php /* @var $this NewsController */ /* @var $model News */ $this->breadcrumbs = array('ประชาสัมพันธ์/กิจกรรม' => array('index'), 'จัดการข้อมูล'); $this->menu = array(array('label' => 'เพิ่มข้อมูล', 'url' => array('create'))); Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$('#news-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n"); ?> <h1>จัดการประชาสัมพันธ์/กิจกรรม</h1> <?php echo CHtml::link('ค้นหาแบบละเอียด', '#', array('class' => 'search-button')); ?> <div class="search-form" style="display:none"> <?php $this->renderPartial('_search', array('model' => $model, 'news_type_list' => $news_type_list, 'news_group_list' => $news_group_list)); ?> </div><!-- search-form --> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'news-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('header' => 'ลำดับ', 'type' => 'raw', 'value' => '$this->grid->dataProvider->pagination->currentPage*$this->grid->dataProvider->pagination->pageSize + $row+1', 'htmlOptions' => array('style' => 'text-align: center;width: 30px;')), array('name' => 'name_th', 'header' => 'หัวข้อข่าว', 'htmlOptions' => array('style' => 'text-align: left;')), array('name' => 'news_type_id', 'header' => 'ประเภทหลัก', 'value' => '$data->newsType->name_th', 'htmlOptions' => array('style' => 'text-align: left;width: 120px;'), 'filter' => CHtml::listData(NewsType::model()->findAll('status=1 AND news_type_id<>2 AND news_type_id<>3'), 'news_type_id', 'name_th')), array('name' => 'news_group_id', 'header' => 'ประเภทย่อย', 'value' => '$data->newsGroup->name_th', 'htmlOptions' => array('style' => 'text-align: left;width: 120px;'), 'filter' => CHtml::listData(NewsGroup::model()->findAll('status=1'), 'news_group_id', 'name_th')), array('name' => 'status', 'value' => '($data->status)? \'แสดง\' : \'ไม่แสดง\'', 'htmlOptions' => array('style' => 'text-align: center;width: 50px;'), 'filter' => array('1' => 'แสดง', '0' => 'ไม่แสดง')), array('class' => 'CButtonColumn', 'template' => '{update} {delete}', 'headerHtmlOptions' => array('style' => 'width:40px;'), 'htmlOptions' => array('style' => 'width:40px; text-align:center')))));
<?php $id = getREQUEST('_Id'); $objCat = new NewsType(); $obj = new News(); if ($id) { $list = $obj->getByType($id); $Cat = $objCat->getById($id); $data['title'] = $Cat[$objCat->getPrefix() . 'title']; //News & Events'; } else { forceRedirect(BASE_URL); die; $list = $obj->get(); $data['title'] = 'News & Events'; } $data['data'] = $list; $data['tot_page'] = ceil(count($list) / NEWS_PER_PAGE); //var_dump($data); //echo $list->rowCount(); echo defaultModule($strModuleName, $data);
<li class="<?php if (getREQUEST('module') == 'Users') { echo 'active'; } ?> "> <a href="home.php?module=Slider"> <img src="../uploads/admin/slider.png"> Slider </a> </li> --> <?php $ObjnewsType = new NewsType(); $menudata = $ObjnewsType->get(array('backend' => '1')); //var_dump($menudata); ?> <?php foreach ($menudata as $row) { ?> <?php $active = ''; $curr_mod_type = ''; if ($row[$ObjnewsType->getPrefix() . 'url'] != 1) { $url = '<a href="home.php?module=' . $row[$ObjnewsType->getPrefix() . 'url'] . '">'; if (getREQUEST('module') == $row[$ObjnewsType->getPrefix() . 'url']) { $active = 'active'; } } elseif ($row['news01hasChild']) {
/** * Manages all models. */ public function actionAdmin() { if ($this->menu_use[3]) { $model = new News('search'); $news_type_list = array(); $criteria = new CDbCriteria(); $criteria->condition = 'status=:status AND news_type_id<>2 AND news_type_id<>3'; $criteria->params = array(':status' => 1); $criteria->order = 'sort_order'; $news_type = NewsType::model()->findAll($criteria); foreach ($news_type as $type) { $news_type_list[$type->news_type_id] = $type->name_th; } $news_group_list = array(); $criteria2 = new CDbCriteria(); $criteria2->condition = 'status=:status AND news_type_id<>2 AND news_type_id<>3'; $criteria2->params = array(':status' => 1); $criteria2->order = 'sort_order'; $news_group = NewsGroup::model()->findAll($criteria2); foreach ($news_group as $group) { $news_group_list[$group->news_group_id] = $group->name_th; } $model->unsetAttributes(); // clear any default values if (isset($_GET['News'])) { $model->attributes = $_GET['News']; } $this->render('admin', array('model' => $model, 'news_type_list' => $news_type_list, 'news_group_list' => $news_group_list)); } else { $this->redirect(array('site/index')); } }
/** * 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 $id the ID of the model to be loaded * @return NewsType the loaded model * @throws CHttpException */ public function loadModel($id) { $model = NewsType::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<li><a href="<?php echo Yii::app()->createUrl('news/media'); ?> ">จากสื่อ</a></li> <li><a href="<?php echo Yii::app()->createUrl('event'); ?> ">ปฏิทินกิจกรรม</a></li> </ul>--> <ul> <?php $criteria = new CDbCriteria(); $criteria->select = '*'; $criteria->condition = '(news_type_id <> 2 AND news_type_id <> 3)'; $criteria->order = 'sort_order'; $NewsType = NewsType::model()->findAll($criteria); foreach ($NewsType as $group) { ?> <li><a href="<?php echo Yii::app()->createUrl('news', array('type_id' => $group->news_type_id)); ?> "><?php echo $group->name_th; ?> </a></li> <?php } ?> </ul> </li> <li><a <?php
?> " name="<?php echo 'url'; ?> "> </td> </tr> <tr> <td> <label >Parent: </label> </td> <td> <select name="parent"> <option value="0">None</option> <?php $ObjnewsType = new NewsType(); $data_newstype = $ObjnewsType->getByParent(0); ?> <?php foreach ($data_newstype as $row) { $selected = ''; if ($_data[$prefix . 'parent'] == $row[$prefix . 'uin']) { $selected = 'selected'; } ?> <option <?php echo $selected; ?> value="<?php echo $row[$prefix . 'uin']; ?>