当前位置: 首页>>代码示例>>PHP>>正文


PHP Program::model方法代码示例

本文整理汇总了PHP中Program::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Program::model方法的具体用法?PHP Program::model怎么用?PHP Program::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Program的用法示例。


在下文中一共展示了Program::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCommentProgram

 public static function getCommentProgram($thread_id)
 {
     $comment = Comment::model()->findByPk($thread_id);
     if (isset($comment) && !is_null($comment)) {
         $prod = Program::model()->findByPk($comment->content_id);
         return array('id' => $prod->id, 'name' => $prod->name, 'poster' => $prod->poster, 'type' => $prod->pro_type);
     }
     return array('id' => '', 'name' => '', 'poster' => '', 'type' => '');
 }
开发者ID:andyongithub,项目名称:joyplus-cms,代码行数:9,代码来源:CacheManager.php

示例2: actionGetProgram

 public function actionGetProgram()
 {
     if (Yii::app()->request->isAjaxRequest) {
         if ($_POST) {
             $dataProgram = Program::model()->findAll('tahun_anggaran=:tahun_anggaran AND status = 0', array(':tahun_anggaran' => $_POST['tahun_anggaran']));
             $this->renderPartial('_program', array('dataProgram' => $dataProgram));
         }
     }
 }
开发者ID:Mapetik,项目名称:ekeg8791,代码行数:9,代码来源:InputRealisasiController.php

示例3: actionDoctor

 public function actionDoctor()
 {
     if (isset($_GET['id'])) {
         $model = Program::model()->findByPk($_GET['id']);
         $this->render('detail', array('model' => $model));
     } else {
         $criteria = new CDbCriteria();
         $criteria->select = '*';
         $criteria->condition = 'status = 1 AND program_type=\'Doctor\'';
         $criteria->order = 'sort_order';
         $total = Program::model()->count($criteria);
         $pages = new CPagination($total);
         $pages->setPageSize(20);
         $pages->applyLimit($criteria);
         $model = Program::model()->findAll($criteria);
         $this->render('doctor', array('model' => $model, 'pages' => $pages));
     }
 }
开发者ID:ultr4h4ck,项目名称:project_gspa,代码行数:18,代码来源:ProgramController.php

示例4: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'review' page.
  */
 public function actionCreate($programId = null, $semesterId = null)
 {
     $this->areaSmall = 'New Post';
     Yii::log($this->module->basePath);
     $college = College::getUserCollege();
     $this->forumBreadcrumb = array('Programs' => array('forum/index'));
     if ($programId) {
         $program = Program::model()->findByPk($programId);
         $this->programId = $programId;
         $this->forumBreadcrumb = array_merge($this->forumBreadcrumb, array($program->program_name => array('forum/programView', 'programId' => $programId)));
     }
     if ($semesterId) {
         $semester = Semester::model()->findByPk($semesterId);
         $this->semesterId = $semesterId;
         $this->forumBreadcrumb = array_merge($this->forumBreadcrumb, array($semester->semester_name => array('forum/viewTopics', 'programId' => $programId, 'semesterId' => $semesterId)));
     }
     $this->forumBreadcrumb = array_merge($this->forumBreadcrumb, array('New Post'));
     $model = new ThreadForm($college->college_id);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['PostItem'])) {
         $model->postItem->attributes = $_POST['PostItem'];
         $model->thread->attributes = $_POST['Thread'];
         $fileUpload = CUploadedFile::getInstance($model->thread, 'attachment');
         Yii::log(CVarDumper::dumpAsString($fileUpload));
         if ($fileUpload !== null) {
             $model->thread->attachment = $fileUpload;
         }
         if ($model->validate()) {
             if ($model->save()) {
                 if ($fileUpload !== null) {
                     $model->thread->attachment->saveAs($this->module->basePath . '/files/' . $model->thread->attachment . "_" . $model->thread->getPrimaryKey());
                 }
                 //$model->thread->attachment->saveAs(Yii::app()->basePath . '/../files/' . $model->thread->attachment);
                 $this->redirect(array('review', 'id' => $model->postItem->post_item_id));
                 exit;
             } else {
                 Yii::app()->user->setFlash('error', 'Unable to post your thread.');
             }
         }
     }
     $this->render('create', array('model' => $model, 'collegeId' => $college->college_id));
 }
开发者ID:aakbar24,项目名称:CollegeCorner_Ver_2.0,代码行数:47,代码来源:PostController.php

示例5: array

<?php

$this->breadcrumbs = array($model->label(2) => array('index'), Yii::t('app', 'Manage'));
$this->menu = array(array('label' => Yii::t('app', 'List') . ' ' . $model->label(2), 'url' => array('index')), array('label' => Yii::t('app', 'Create') . ' ' . $model->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\$.fn.yiiGridView.update('voucher-type-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1><?php 
echo Yii::t('app', 'Manage') . ' ' . GxHtml::encode($model->label(2));
?>
</h1>

<p>
You may optionally enter a comparison operator (&lt;, &lt;=, &gt;, &gt;=, &lt;&gt; or =) at the beginning of each of your search values to specify how the comparison should be done.
</p>

<?php 
echo GxHtml::link(Yii::t('app', 'Advanced Search'), '#', array('class' => 'search-button'));
?>
<div class="search-form">
<?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'voucher-type-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id', 'name', 'create_date', 'deleted_at', array('name' => 'program_id', 'value' => 'GxHtml::valueEx($data->program)', 'filter' => GxHtml::listDataEx(Program::model()->findAllAttributes(null, true))), 'arabic_text', array('class' => 'CButtonColumn'))));
开发者ID:hanihh,项目名称:vvs_v2,代码行数:27,代码来源:admin.php

示例6: actionEditLayanan

 public function actionEditLayanan()
 {
     if ($_POST) {
         Yii::app()->user->returnUrl = Yii::app()->request->urlReferrer;
         $dataLayanan = Layanan::model()->find('id=:id AND id_program=:id_program ', array(':id' => $_POST['id'], ':id_program' => $_POST['id_program']));
         $dataMaxTarget = Program::model()->find('id=:id', array(':id' => $_POST['id_program']));
         $this->render('formeditLayanan', array('dataLayanan' => $dataLayanan, 'dataMaxTarget' => $dataMaxTarget));
     }
 }
开发者ID:Mapetik,项目名称:ekeg8791,代码行数:9,代码来源:RencanaProgramController.php

示例7: actionSearchTopics

 public function actionSearchTopics($string, $progId = null, $semesterId = null)
 {
     $college = College::getUserCollege();
     $this->areaLarge = $college->college_name;
     $this->areaSmall = Yii::t('forum', 'forum.area.search');
     if (!empty($progId)) {
         $this->areaSmall .= " (In " . Program::model()->findByPk($progId)->program_name;
         if (!empty($semesterId)) {
             $this->areaSmall .= " / " . Semester::model()->findByPk($semesterId)->semester_name;
         }
         $this->areaSmall .= " )";
     }
     $this->canPost = false;
     Yii::log($string);
     $threads = Thread::model()->searchTopics($string, $college->college_id, $progId, $semesterId);
     Yii::log(CVarDumper::dumpAsString($threads));
     $topicRows = array();
     foreach ($threads as $i => $thread) {
         $row = array('id' => $thread['thread_id'], 'topic' => $thread['title'], 'program_name' => $thread['program_name'], 'program' => $thread['program_id'], 'semester' => CHtml::link($thread['semester_name'], array('viewTopics', 'programId' => $thread['program_id'], 'semesterId' => $thread['semester_id'])), 'progCode' => $thread['program_code'], 'postDate' => $thread['date_created'], 'numReplies' => $thread['reply_count']);
         $topicRows[] = $row;
     }
     $gridColumns = array(array('name' => 'topic', 'header' => 'Topic', 'type' => 'raw', 'value' => 'CHtml::link($data["topic"], array("post/readTopic", "id" => $data["id"]));'), array('name' => 'program_name', 'header' => 'Program', 'type' => 'raw', 'value' => 'CHtml::link($data["program_name"], array("programView", "programId" => $data["program"]));'), array('name' => 'semester', 'header' => 'Semester', 'type' => 'raw'), array('name' => 'postDate', 'header' => 'Post Date', 'filter' => false, 'value' => 'Yii::app()->timeagoFormat->timeago(new DateTime($data["postDate"]))'), array('name' => 'numReplies', 'header' => 'Replies', 'filter' => false));
     $filtersForm = new FiltersForm();
     if (isset($_GET['FiltersForm'])) {
         $filtersForm->filters = $_GET['FiltersForm'];
     }
     $filteredData = $filtersForm->filter($topicRows);
     $forumGridData = new CommunityArrayDataProvider(array_values($filteredData), array('sort' => array('attributes' => array('topic', 'program', 'postDate', 'numReplies')), 'pagination' => array('pageSize' => Yii::app()->params['forum_pageSize'])));
     $forumGridData->setPagination(false);
     $this->emptyText = "No topics could be found";
     $this->render('topics', array('gridColumns' => $gridColumns, 'forumGridData' => $forumGridData, 'filtersForm' => $filtersForm));
 }
开发者ID:aakbar24,项目名称:CollegeCorner_Ver_2.0,代码行数:32,代码来源:ForumController.php

示例8: array

		<?php 
echo $form->labelEx($model, 'name');
?>
		<?php 
echo $form->textField($model, 'name', array('maxlength' => 255));
?>
		<?php 
echo $form->error($model, 'name');
?>
		</div><!-- row -->
		<div class="row">
		<?php 
echo $form->labelEx($model, 'program_id');
?>
		<?php 
echo $form->dropDownList($model, 'program_id', GxHtml::listDataEx(Program::model()->findAllAttributes(null, true)));
?>
		<?php 
echo $form->error($model, 'program_id');
?>
		</div><!-- row -->
		<div class="row">
		<?php 
echo $form->labelEx($model, 'code');
?>
		<?php 
echo $form->textField($model, 'code', array('maxlength' => 10));
?>
		<?php 
echo $form->error($model, 'code');
?>
开发者ID:hanihh,项目名称:vvs_v2,代码行数:31,代码来源:_form.php

示例9: array

	<div class="row">
		<?php 
echo $form->label($model, 'name');
?>
		<?php 
echo $form->textField($model, 'name', array('maxlength' => 50));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'program_id');
?>
		<?php 
echo $form->dropDownList($model, 'program_id', GxHtml::listDataEx(Program::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', 'All')));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'donor_id');
?>
		<?php 
echo $form->dropDownList($model, 'donor_id', GxHtml::listDataEx(Donor::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', 'All')));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'online');
开发者ID:hanihh,项目名称:vvs_v2,代码行数:30,代码来源:_search.php

示例10: getPersentaseRealisasi

 public static function getPersentaseRealisasi($tag, $id)
 {
     if ($tag == "layanan") {
         $counter = 0;
         $dataLayanan = Layanan::model()->find('id=:id', array(':id' => $id));
         $countRealisasi = count($dataLayanan['kegiatan']);
         if ($countRealisasi > 0) {
             foreach ($dataLayanan['kegiatan'] as $key) {
                 foreach ($key->realisasi as $key2) {
                     $counter += $key2->nominal;
                 }
             }
             return intval($counter / $dataLayanan['target'] * 100) . "% ";
         }
         return "0%";
     } else {
         if ($tag == "program") {
             $counter = 0;
             $dataProgram = Program::model()->find('id=:id', array(':id' => $id));
             foreach ($dataProgram['kegiatan'] as $key) {
                 foreach ($key->realisasi as $key2) {
                     $counter += $key2->nominal;
                 }
             }
             return intval($counter / $dataProgram['target'] * 100) . "% ";
         } else {
             if ($tag == "all") {
                 $counter = 0;
                 $counter2 = 0;
                 $dataProgram = Program::model()->findAll('status=:status AND tahun_anggaran=:tahun_anggaran', array(':status' => "1", ':tahun_anggaran' => "2015"));
                 foreach ($dataProgram as $key) {
                     foreach ($key->kegiatan as $key2) {
                         foreach ($key2->realisasi as $key3) {
                             $counter += $key3->nominal;
                         }
                     }
                     $counter2 += $key->target;
                 }
                 return intval($counter / $counter2 * 100) . "% ";
             }
         }
     }
 }
开发者ID:Mapetik,项目名称:ekeg8791,代码行数:43,代码来源:DatabaseUmum.php

示例11: actionDownloadV1

 public function actionDownloadV1()
 {
     if (isset($_POST['tahun_anggaran'])) {
         $tahun_anggaran = $_POST['tahun_anggaran'];
     } else {
         $tahun_anggaran = '2015';
     }
     $dataProgram = Program::model()->findAll('status=:status AND tahun_anggaran=:tahun_anggaran', array(':status' => '1', ':tahun_anggaran' => $tahun_anggaran));
     Yii::import('ext.PHPExcel.Classes.PHPExcel');
     $objPHPExcel = new PHPExcel();
     $objPHPExcel->getProperties()->setCreator("PPS Universitas Negeri Semarang")->setLastModifiedBy("TIM Web E-POK PPS UNNES")->setTitle("Rekap Kegiatan PPS UNNES Tahun {$tahun_anggaran}");
     // SET THE HEADER DOCUMENT
     for ($m = 0; $m < 12; $m++) {
         // SET THE HEADER DOCUMENT
         $month = date('Y');
         $objPHPExcel->createSheet($m);
         $objPHPExcel->setActiveSheetIndex($m)->setTitle(date('M', mktime(0, 0, 0, $m + 2, 0, 0)));
         // Header Document
         $objPHPExcel->setActiveSheetIndex($m)->mergeCells('A1:L1')->mergeCells('A2:L2')->mergeCells('A3:L3')->mergeCells('A4:L4')->setCellValue('A1', 'LAPORAN REALISASI ALOKASI PENGGUNAAN ANGGARAN')->setCellValue('A2', 'PROGRAM PASCASARJANA UNNES')->setCellValue('A3', 'TAHUN ANGGARAN 2015')->setCellValue('D2', 'world!');
         $objPHPExcel->getActiveSheet()->getStyle('A1:L6')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('A1:L6')->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
         $objPHPExcel->getActiveSheet()->getStyle('A1:L6')->getAlignment()->setWrapText(true);
         //Header Table
         $objPHPExcel->setActiveSheetIndex($m)->mergeCells('A6:A7')->mergeCells('B6:B7')->mergeCells('C6:G6')->mergeCells('H6:H7')->mergeCells('I6:I7')->mergeCells('J6:J7')->mergeCells('K6:K7')->mergeCells('L6:L7')->setCellValue('A6', 'Kode')->setCellValue('B6', 'Uraian Unit/Program/Kegiatan/Output/Akun Belanja/Detil Belanja')->setCellValue('C6', 'TA 2015')->setCellValue('C7', 'Volume')->setCellValue('D7', 'Satuan')->setCellValue('E7', 'Harga Satuan')->setCellValue('F7', 'Target')->setCellValue('G7', 'SD')->setCellValue('H6', 'Bulan')->setCellValue('I6', 'Realisasi s.d Bulan Ini')->setCellValue('J6', 'Saldo')->setCellValue('K6', '%')->setCellValue('L6', 'Penanggung Jawab');
         $i = 9;
         foreach ($dataProgram as $key) {
             $realisasiProgram = DatabaseUmum::getRealisasiOnMonthFromProgram($key->id, $m);
             $realisasiProgramUntilMonth = DatabaseUmum::getRealisasiUntilMonthFromProgram($key->id, $m);
             $objPHPExcel->getActiveSheet()->setCellValue("A{$i}", $key->kode_program)->setCellValue("B{$i}", $key->nama_program)->setCellValue("C{$i}", "-")->setCellValue("D{$i}", "-")->setCellValue("E{$i}", "-")->setCellValue("F{$i}", $key->target)->setCellValue("G{$i}", "-")->setCellValue("H{$i}", $realisasiProgram)->setCellValue("I{$i}", $realisasiProgramUntilMonth)->setCellValue("J{$i}", "=F{$i}-I{$i}")->setCellValue("K{$i}", "=I{$i}/F{$i} * 100");
             $i++;
             foreach ($key->layanan as $key2) {
                 $realisasiLayanan = DatabaseUmum::getRealisasiOnMonthFromLayanan($key->id, $m);
                 $realisasiLayananUntilMonth = DatabaseUmum::getRealisasiUntilMonthFromLayanan($key->id, $m);
                 $objPHPExcel->getActiveSheet()->setCellValue("A{$i}", $key2->kode_layanan)->setCellValue("B{$i}", $key2->nama_layanan)->setCellValue("C{$i}", "-")->setCellValue("D{$i}", "-")->setCellValue("E{$i}", "-")->setCellValue("F{$i}", $key2->target)->setCellValue("G{$i}", "-")->setCellValue("H{$i}", $realisasiLayanan)->setCellValue("I{$i}", $realisasiLayananUntilMonth)->setCellValue("K{$i}", "%")->setCellValue("J{$i}", "=F{$i}-I{$i}")->setCellValue("K{$i}", "=I{$i}/F{$i} * 100");
                 $i++;
                 foreach ($key2->kegiatan as $key3) {
                     $realisasi = DatabaseUmum::getRealisasi($key3->id, $m);
                     $realisasiSampaiBulan = DatabaseUmum::getSumOfRealisasi($key3->id, $m);
                     $objPHPExcel->getActiveSheet()->setCellValue("A{$i}", $key3->kode_kegiatan)->setCellValue("B{$i}", $key3->nama_kegiatan)->setCellValue("C{$i}", $key3->volume)->setCellValue("D{$i}", $key3->satuan)->setCellValue("E{$i}", $key3->harga_satuan)->setCellValue("F{$i}", $key3->target)->setCellValue("G{$i}", $key3->SumberDana->nama)->setCellValue("H{$i}", $realisasi)->setCellValue("I{$i}", $realisasiSampaiBulan)->setCellValue("J{$i}", "=F{$i}-I{$i}")->setCellValue("K{$i}", "=I{$i}/F{$i} * 100")->setCellValue("L{$i}", $key3->PenanggungJawab->nama);
                     // $objPHPExcel->getActiveSheet()->getStyle("E$i")->getNumberFormat()->setFormatCode('_-Rp* #.##0_-;-Rp* #.##0_-;_-Rp* "-"_-;_-@_-');
                     $i++;
                 }
             }
         }
         $objPHPExcel->getActiveSheet()->getStyle('A6:L7')->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => '236A04')), 'font' => array('bold' => true, 'color' => array('rgb' => 'FFFFFF'))));
         // normalize all column width
         $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth("9.86");
         $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth("53.57");
         $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth("12.75");
         $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth("7.14");
         $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth("9.86");
         $objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth("12.71");
         $objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth("14.71");
         $objPHPExcel->getActiveSheet()->getColumnDimension('I')->setWidth("16");
         $objPHPExcel->getActiveSheet()->getColumnDimension('J')->setWidth("14.71");
         $objPHPExcel->getActiveSheet()->getColumnDimension('K')->setWidth("8.43");
         $objPHPExcel->getActiveSheet()->getColumnDimension('L')->setWidth("24.29");
     }
     header('Content-Type: application/vnd.ms-excel');
     header('Content-Disposition: attachment;filename="test.xls"');
     header('Cache-Control: max-age=0');
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
     $objWriter->save('php://output');
 }
开发者ID:Mapetik,项目名称:ekeg8791,代码行数:64,代码来源:DownloadRekapController.php

示例12: getProgramCache

 public static function getProgramCache($prod_id)
 {
     $key = CacheManager::CACHE_PROD_BY_PROD_ID . '_' . $prod_id;
     $prod = CacheManager::getValueFromCache($key);
     if ($prod) {
         return $prod;
     }
     $prod = Program::model()->findByPk($prod_id);
     if (isset($prod) && !is_null($prod)) {
         $prodExpired = CacheManager::getExpireByCache(CacheManager::CACHE_PARAM_EXPIRED_PROGRAM);
         CacheManager::setValueToCache($key, $prod, $prodExpired);
     }
     return $prod;
 }
开发者ID:andyongithub,项目名称:joyplus-cms,代码行数:14,代码来源:CacheManager.php

示例13: createComments

 public function createComments()
 {
     $transaction = Yii::app()->db->beginTransaction();
     try {
         if ($this->save()) {
             $program = CacheManager::getProgramVOByID($this->content_id);
             Program::model()->incCommentCount($this->content_id);
             if ($program !== null) {
                 //	      	var_dump(($program->name));
                 $dynamic = new Dynamic();
                 $dynamic->author_id = $this->author_id;
                 $dynamic->content_id = $program->id;
                 $dynamic->status = Constants::OBJECT_APPROVAL;
                 $dynamic->create_date = new CDbExpression('NOW()');
                 $dynamic->content_desc = $this->comments;
                 $dynamic->content_type = $program->pro_type;
                 $dynamic->content_name = $program->name;
                 $dynamic->dynamic_type = Constants::DYNAMIC_TYPE_COMMENTS;
                 $dynamic->content_pic_url = $program->poster;
                 $dynamic->save();
                 $recommendOwnerId = Dynamic::model()->getRecommendOwnsForProd($this->content_id);
                 if (isset($recommendOwnerId) && is_array($recommendOwnerId)) {
                     foreach ($recommendOwnerId as $id) {
                         if ($id['author_id'] !== Yii::app()->user->id) {
                             // add notify msg
                             $msg = new NotifyMsg();
                             $msg->author_id = $id['author_id'];
                             $msg->nofity_user_id = Yii::app()->user->id;
                             $msg->notify_user_name = Yii::app()->user->getState("nickname");
                             $msg->notify_user_pic_url = Yii::app()->user->getState("pic_url");
                             $msg->content_id = $program->id;
                             $msg->content_info = $program->name;
                             $msg->content_type = $program->pro_type;
                             $msg->created_date = new CDbExpression('NOW()');
                             $msg->status = Constants::OBJECT_APPROVAL;
                             $msg->notify_type = Constants::NOTIFY_TYPE_COMMENT;
                             $msg->content_desc = $this->comments;
                             $msg->save();
                         }
                     }
                 }
             }
             $transaction->commit();
             return true;
         } else {
             $transaction->commit();
             return false;
         }
     } catch (Exception $e) {
         $transaction->rollback();
         return false;
     }
 }
开发者ID:andyongithub,项目名称:joyplus-cms,代码行数:53,代码来源:Comment.php

示例14: actionViewRecommend

 public function actionViewRecommend()
 {
     header('Content-type: application/json');
     if (!IjoyPlusServiceUtils::validateAPPKey()) {
         IjoyPlusServiceUtils::exportServiceError(Constants::APP_KEY_INVALID);
         return;
     }
     if (IjoyPlusServiceUtils::validateUserID()) {
         IjoyPlusServiceUtils::exportServiceError(Constants::USER_ID_INVALID);
         return;
     }
     $prod_id = Yii::app()->request->getParam("prod_id");
     if (!isset($prod_id) || is_null($prod_id)) {
         IjoyPlusServiceUtils::exportServiceError(Constants::PARAM_IS_INVALID);
         return;
     }
     $program = Program::model()->findByPk($prod_id);
     if ($program === null) {
         IjoyPlusServiceUtils::exportServiceError(Constants::OBJECT_NOT_FOUND);
         return;
     }
     $userid = Yii::app()->request->getParam("user_id");
     if (!isset($userid) || is_null($userid)) {
         $userid = Yii::app()->user->id;
     }
     $prod = ProgramUtil::exportProgramEntity($program);
     $reCom = Dynamic::model()->getDynamicByProd($userid, $prod_id, Constants::DYNAMIC_TYPE_RECOMMEND);
     if (isset($reCom) && !is_null($reCom)) {
         $prod['reason'] = $reCom->content_desc;
     }
     $comments = Comment::model()->getCommentsByProgram($prod_id, 10, 0);
     if (isset($comments) && is_array($comments)) {
         $commentTemps = array();
         foreach ($comments as $comment) {
             $commentTemps[] = IjoyPlusServiceUtils::transferComments($comment);
         }
         $prod['comments'] = $commentTemps;
     } else {
         $prod['comments'] = array();
     }
     $dynamic = Dynamic::model()->friendDynamicForProgram(Yii::app()->user->id, $prod_id, 10, 0);
     if (isset($dynamic) && is_array($dynamic)) {
         $prod['dynamics'] = $this->transferDynamics($dynamic);
     } else {
         $prod['dynamics'] = array();
     }
     $topics = Topic::model()->getRelatedTops($prod_id);
     if (isset($topics) && is_array($topics)) {
         $prod['topics'] = $topics;
     } else {
         $prod['topics'] = array();
     }
     IjoyPlusServiceUtils::exportEntity($prod);
 }
开发者ID:andyongithub,项目名称:joyplus-cms,代码行数:54,代码来源:ProgramController.php

示例15: loadModel

 /**
  * 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 Program the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Program::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:ultr4h4ck,项目名称:project_gspa,代码行数:15,代码来源:ProgramController.php


注:本文中的Program::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。