public function listAction() { //查询数据 $category = new \FileCategory(); $list = $category->getList(); //数据 //加载js $this->assets->addJs('backend/mt/filecategory-list.js'); $this->view->setVars(['list' => $list]); }
?> </td> </tr> </table> </div> <div class="inner_new_formCon_row"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="20%"><?php echo $form->labelEx($model, 'category'); ?> </td> <td width="80%"><?php echo $form->dropDownList($model, 'category', CHtml::listData(FileCategory::model()->findAll(), 'id', 'category'), array('prompt' => 'Select category')); ?> <?php echo $form->error($model, 'category'); ?> </td> </tr> </table> </div> <div class="inner_new_formCon_row"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr>
echo $category->Name; ?> "><?php echo $category->Title; ?> </a> <?php } } ?> </div> </td> <td> <?php if ($categoryName != "") { $category = FileCategory::GetByName($categoryName); } else { $category = null; } $files = File::GetByUser($thisuser, $category); $count = count($files); ?> <div class="ProfilePage"> <div class="ProfileTitle"> <span class="ProfileUserName"><?php if ($count == 1) { echo "There is 1 file"; } else { echo "There are " . $count . " files"; }
/** * 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 = FileCategory::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public static function GetByName($name) { if ($name == null) { return null; } $query = "SELECT * FROM phpmmo_storage_categories WHERE category_name = '" . mysql_real_escape_string($name) . "'"; $result = mysql_query($query); $values = mysql_fetch_assoc($result); return FileCategory::GetByAssoc($values); }
echo Yii::t('downloads', 'Batch'); ?> </th> <th><?php echo Yii::t('downloads', 'File Name'); ?> </th> </tr> <tr> <td><?php echo $model->title; ?> </td> <td> <?php $category = FileCategory::model()->findByAttributes(array('id' => $model->category)); echo $category->category; ?> </td> <td> <?php if ($model->placeholder) { echo ucfirst($model->placeholder); } else { echo 'Public'; } ?> </td> <td> <?php if ($model->course) {
public function files($id) { if ($this->isAdminRequest()) { //Get File Categories $filecategories = array('' => 'Choose a Category') + FileCategory::lists('file_category_name', 'id'); $productcategory = ProductCategory::find($id); return View::make('admin.products.files')->with('productcategory', $productcategory)->with('filecategories', $filecategories)->with('files', $productcategory->files)->with('imgexts', array('jpg', 'png', 'gif')); } }