本文整理汇总了PHP中app\models\Category::getCategory方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::getCategory方法的具体用法?PHP Category::getCategory怎么用?PHP Category::getCategory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Category
的用法示例。
在下文中一共展示了Category::getCategory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
public function actionIndex()
{
$categories = Category::getCategory();
return $this->render('index', ['categories' => $categories]);
}
示例2: saveHistory
public function saveHistory($action, $object = null, $dop = null)
{
switch ($action) {
case 'create_category':
$message = "Создал категорию [" . $object . "]";
$label = 'Категории';
$colorLabel = 'label label-success';
break;
case 'rename_category':
$message = "Переименовал категорию [" . $object . "]";
$label = 'Категории';
$colorLabel = 'label label-success';
break;
case 'move_category':
$categoryModel = new Category();
$category = $categoryModel->getCategory($object, array('name'));
$message = "Переименовал категорию [" . $category->name . "]";
$label = 'Категории';
$colorLabel = 'label label-success';
break;
case 'status_category':
$categoryModel = new Category();
$category = $categoryModel->getCategory($object, array('name'));
if ($dop) {
$message = "Включил категорию [" . $category->name . "]";
} else {
$message = "Отключил категорию [" . $category->name . "]";
}
$label = 'Категории';
$colorLabel = 'label label-success';
break;
case 'create_user':
$message = "Создал пользователя [" . $object . "]";
$label = 'Пользователи';
$colorLabel = 'label';
break;
case 'update_user':
$message = "Отредактировал пользователя(ей) [" . $object . "]";
$label = 'Пользователи';
$colorLabel = 'label';
break;
case 'status_user':
$userModel = new User();
$user = $userModel->getUser($object, array('showname'));
if ($dop) {
$message = "Включил пользователя [" . $user->showname . "]";
} else {
$message = "Отключил пользователя [" . $user->showname . "]";
}
$label = 'Пользователи';
$colorLabel = 'label';
break;
case 'create_currency':
$message = "Создал новую валюту [" . $object . "]";
$label = 'Валюты';
$colorLabel = 'label label-warning';
break;
case 'delete_currency':
$currencyModel = new Currency();
$currency = $currencyModel->getNameCurrencyById($object);
$message = "Удалил валюту [" . $currency . "]";
$label = 'Валюты';
$colorLabel = 'label label-warning';
break;
case 'update_rate':
$currencyModel = new Currency();
$currency = $currencyModel->getNameCurrencyById($object['currency_id']);
$message = "Установил курс [" . $currency . " = " . $object['rate'] . "]";
$label = 'Валюты';
$colorLabel = 'label label-warning';
break;
case 'auto_update_currency':
$this->insert(array('label' => "Валюты", 'color_label' => 'label label-warning', 'action' => "Обновлены курсы валют по ЦБ", 'user_id' => $object, 'created_at' => date('Y-m-d H:i:s')));
return true;
break;
case 'create_note':
$message = "Создал публичную заметку";
$label = 'Заметки';
$colorLabel = 'label';
break;
case 'update_products':
$product = array();
foreach ($object as $key => $elem) {
$product[] = "<a class='h_def' href='/product/" . $key . "'>" . $key . "</a>";
}
$message = "Отредактировал товар(ы) [" . implode(', ', $product) . "]";
$label = 'Товары и цены';
$colorLabel = 'label label-primary';
break;
case 'import':
$text = '';
if (isset($object['update_prod'])) {
$text .= "[" . plural_form($object['update_prod'], 'обновлен', false) . ' ' . plural_form($object['update_prod'], 'товар') . "] ";
}
if (isset($object['add_prod'])) {
$text .= "[" . plural_form($object['add_prod'], 'добавлен', false) . ' ' . plural_form($object['add_prod'], 'товар') . "] ";
}
if (isset($object['add_to_GK'])) {
$text .= "[на ГК " . plural_form($object['add_to_GK'], 'добавлен', false) . ' ' . plural_form($object['add_to_GK'], 'товар') . "] ";
}
//.........这里部分代码省略.........
示例3: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id, Category $categoryModel, Provider $providerModel)
{
if (!right('EditCategory')) {
abort(404);
}
$category = $categoryModel->getCategory($id);
if (count($category) < 1) {
abort(404);
}
$fullList = $categoryModel->getFullCategoriesList();
$providers_list = $providerModel->getExistInCategoryProvedrsList($id);
$chain = $categoryModel->getParents($id);
return view('category.edit')->with('title', 'Редактирование категории ' . $category->name)->with('category', $category)->with('chain', $chain)->with('fullList', $fullList)->with('provider_list', $providers_list)->with('current_id', $id);
}
示例4: actionView
/**
* Displays a single Category model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
$categoryModel = new Category();
$category = $categoryModel->getCategory($id);
return $this->render('index', ['category' => $category, 'posts' => $category->getPosts(), 'categories' => $categoryModel->getCategories()]);
}