本文整理汇总了PHP中Category::unsetAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::unsetAttributes方法的具体用法?PHP Category::unsetAttributes怎么用?PHP Category::unsetAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Category
的用法示例。
在下文中一共展示了Category::unsetAttributes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionManage
public function actionManage()
{
$model = new Category('search');
$model->unsetAttributes();
if (isset($_GET['Category'])) {
$model->setAttributes($_GET['Category']);
}
$this->render('manage', array('model' => $model));
}
示例2: actionIndex
/**
* Manages all models.
*/
public function actionIndex()
{
$model = new Category('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['Category'])) {
$model->attributes = $_GET['Category'];
}
$this->render('index', array('model' => $model));
}
示例3: actionIndex
public function actionIndex()
{
$this->pageTitle = 'Теги';
$this->breadcrumbs = array('Теги');
$model = new Category('search');
$model->unsetAttributes();
if (isset($_GET['Category'])) {
$model->attributes = $_GET['Category'];
}
$dataProvider = $model->active()->search();
$this->render('index', array('model' => $model, 'dataProvider' => $dataProvider));
}
示例4: actionIndex
public function actionIndex() {
$this->pageTitle = 'Рубрики';
$model = new Category('search');
$model->unsetAttributes();
if(isset($_GET['Category']))
$model->attributes=$_GET['Category'];
$dataProvider = $model->search();
$this->render('index', array(
'model' => $model,
'dataProvider'=>$dataProvider,
));
}
示例5: actionAdmin
public function actionAdmin()
{
$model = new Category('search');
$model->unsetAttributes();
if (isset($_GET['Category'])) {
$model->attributes = $_GET['Category'];
}
$this->render('admin', array('model' => $model));
}
示例6: actionAdmin
/**
* Manages all models.
*/
public function actionAdmin()
{
$model = new Category('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['Category'])) {
$model->attributes = $_GET['Category'];
}
if ($this->isExportRequest()) {
$this->exportCSV($model->search(), array('name', 'descr', 'pid', 'getparent.name'));
}
$this->render('admin', array('model' => $model));
}
示例7: actionAdmin
/**
* Manages all models.
*/
public function actionAdmin()
{
$model = new Category('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['Category'])) {
$model->attributes = $_GET['Category'];
}
if (isset($_GET['pageSize'])) {
Yii::app()->user->setState('categoryPageSize', (int) $_GET['pageSize']);
unset($_GET['pageSize']);
}
$this->render('admin', array('model' => $model));
}
示例8: actionAdmin
/**
* Manages all models.
*/
public function actionAdmin()
{
if (Yii::app()->user->checkAccess($this->id . '.' . $this->action->id)) {
$model = new Category('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['Category'])) {
$model->attributes = $_GET['Category'];
}
$this->render('admin', array('model' => $model));
} else {
$this->accessDenied();
}
}
示例9: actionAdmin
/**
* Manages all models.
*/
public function actionAdmin()
{
date_default_timezone_set("Asia/Manila");
$activity = new Activity();
$activity->act_desc = 'Viewed Category List';
$activity->act_datetime = date('Y-m-d G:i:s');
$activity->act_by = User::model()->findByPK(Yii::app()->user->name)->emp_id;
$activity->save();
$model = new Category('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['Category'])) {
$model->attributes = $_GET['Category'];
}
$this->render('admin', array('model' => $model));
}
示例10: commonsectionAdmin
public function commonsectionAdmin($root = false)
{
$this->pageTitle = get_class( Category::model() );
$model = new Category( 'search' );
$model->unsetAttributes(); // clear any default values
if ( isset( $_GET['Category'] ) )
$model->attributes = $_GET['Category'];
if($root)
{
$model->parent_id = Helper::CONST_RootCategory;
}
else
{
$model->parent_id = Helper::CONST_Category;
}
$this->render( 'admin1', array(
'model' => $model,
) );
}
示例11: actionAdmin
/**
* Manages all models.
*/
public function actionAdmin()
{
$this->layout = 'site-admin';
$this->activeMenuItemIndex = 2;
$model = new Category('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['Category'])) {
$model->attributes = $_GET['Category'];
}
$this->render('admin', array('model' => $model));
}
示例12: actionAdmin
/**
* Manages all models.
*/
public function actionAdmin()
{
$model = new Category('search');
$catlist = Category::getDropList(0);
$model->unsetAttributes();
// clear any default values
if (isset($_GET['Category'])) {
$model->attributes = $_GET['Category'];
}
$this->render('admin', array('model' => $model, 'catlist' => $catlist));
}
示例13: actionAdmin
/**
* Manages all models.
*/
public function actionAdmin()
{
$lang = $this->getLanguageCode();
$model = new Category();
$listCate = $model->getListCategory($lang);
$model->unsetAttributes();
$tree = Yii::app()->extraFunctions->parseTree($listCate);
$this->render('admin', array('tree' => json_encode($tree)));
}
示例14: actionList
/**
* Displays a particular model's products as a long list.
* @param str $slug the 'slug' identifier of the model to be displayed
*/
public function actionList($slug)
{
// Retrieve the model via it's slug
$model_localization = $this->loadLocalizationModelSlug($slug);
$model = $model_localization->category;
if (!$model->visible) {
throw new CHttpException(404, Yii::t('app', 'La page demandée n\'existe pas.'));
}
$this->pageTitle = $model_localization->name . " - " . Yii::app()->name;
$alternatives = array();
foreach ($model->categoryLocalizations as $localization) {
$alternatives[$localization->locale_id] = $this->createAbsoluteUrl("view", array("slug" => $localization->slug, "language" => $localization->locale_id));
}
$this->alternatives = $alternatives;
// Generate the subcategories to display in the sidebar.
// Generate the subcategories to display in the sidebar.
$children_cache_id = Yii::app()->request->hostInfo . " CategoryController:[children_cats_for_cat] " . $model->id;
$cache_duration = 300;
$menu_array = Yii::app()->cache->get($children_cache_id);
if (!$menu_array) {
$menu_array = array();
$children = new Category();
$children->unsetAttributes();
$children->visible = 1;
$children->id = $model->id;
$category_data_provider = $children->searchChildren();
foreach ($category_data_provider->getData() as $child) {
if ($this->isB2b()) {
// In a B2B store, we show a list of products so users can select many products at once
$menu_array[] = array('label' => $child->categoryLocalization->name, 'url' => array('category/list', "slug" => $child->categoryLocalization->slug));
} else {
$menu_array[] = array('label' => $child->categoryLocalization->name, 'url' => array('category/view', "slug" => $child->categoryLocalization->slug));
}
}
Yii::app()->cache->set($children_cache_id, $menu_array, $cache_duration);
}
$this->menu = $menu_array;
if ($model->parent_category) {
// This is a subcategory
// Subcategories must display their products. They must also add their parents categories to the page's breadcrumbs
// Display breadcrumbs in the right order (home >> root category >> subcategory 1 >> subcatory 2, etc.)
$this->breadcrumbs = array();
function appendMotherCatToBreadcrumbs($cat, &$breadarray, $locale)
{
$locale_category = CategoryLocalization::model()->find("category_id = :category AND locale_id = :locale", array(":category" => $cat->id, ":locale" => $locale));
$breadarray[$locale_category->name] = array("category/view", "slug" => $locale_category->slug);
if ($cat->parent_category) {
appendMotherCatToBreadcrumbs($cat->parentCategory, $breadarray, $locale);
}
}
if ($model->parent_category) {
appendMotherCatToBreadcrumbs($model->parentCategory, $this->breadcrumbs, Yii::app()->language);
// The array returned is reversed (top category at the end) we need to reverse it.
$this->breadcrumbs = array_reverse($this->breadcrumbs);
}
// We're at the end of the run, just append our name
$this->breadcrumbs[] = $model_localization->name;
// Retrieve the order's products (with the correct localization)
$products_data_provider = null;
$product = new Product();
$product->unsetAttributes();
$product->visible = 1;
$product->discontinued = 0;
$product->categoryId = $model->id;
$product->restrictScopeToCurrentLocale = false;
if ($model->is_brand) {
$products_data_provider = $product->searchForBrand($model);
} else {
$products_data_provider = $product->search();
}
$products_data_provider->setPagination(array('pageSize' => 100));
$this->render('list', array('model' => $model, 'localization' => $model_localization, 'products' => $products_data_provider));
} else {
throw new CHttpException(404, Yii::t('app', 'La page demandée n\'existe pas.'));
}
}
示例15: actionAdmin
/**
* Manages all models.
*/
public function actionAdmin()
{
$Category = new Category('search');
$Category->unsetAttributes();
// clear any default values
if (isset($_GET['Category'])) {
$Category->attributes = $_GET['Category'];
}
$this->render('admin', array('Category' => $Category));
}