本文整理汇总了PHP中Categories类的典型用法代码示例。如果您正苦于以下问题:PHP Categories类的具体用法?PHP Categories怎么用?PHP Categories使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Categories类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($options = null)
{
$baseDir = $options['baseDir'];
$pageID = $options['pageID'];
parent::__construct($options);
/****************************************/
// PARAMETERS
/****************************************/
// select box category (Parameter #1)
$blockCategory = new Zend_Form_Element_Select('Param1');
$blockCategory->setLabel($this->getView()->getCibleText('form_gallery_blockCategory_label'))->setAttrib('class', 'largeSelect')->setOrder(11);
$categories = new Categories();
$select = $categories->select()->setIntegrityCheck(false)->from('Categories')->join('CategoriesIndex', 'C_ID = CI_CategoryID')->where('C_ModuleID = ?', 9)->where('CI_LanguageID = ?', Zend_Registry::get("languageID"))->order('CI_Title');
$categoriesArray = $categories->fetchAll($select);
foreach ($categoriesArray as $category) {
$blockCategory->addMultiOption($category['C_ID'], $category['CI_Title']);
}
$this->addElement($blockCategory);
$blockGallery = new Zend_Form_Element_Select('Param2');
$blockGallery->setLabel($this->getView()->getCibleText('form_gallery_blockGallerey_label'))->setAttrib('class', 'largeSelect')->setOrder(12);
$galleries = new Galleries();
$selectG = $galleries->select()->setIntegrityCheck(false)->from('Galleries')->join('GalleriesIndex', 'G_ID = GI_GalleryID')->where('G_Online = 1')->where('GI_LanguageID = ?', Zend_Registry::get("languageID"))->order('GI_Title');
$galleriesArray = $galleries->fetchAll($selectG);
//echo $selectG;
$blockGallery->addMultiOption('0', $this->getView()->getCibleText('form_gallery_blockGallerey_None'));
foreach ($galleriesArray as $gallery) {
$blockGallery->addMultiOption($gallery['GI_GalleryID'], $gallery['GI_Title']);
}
$this->addElement($blockGallery);
$this->removeDisplayGroup('parameters');
$this->addDisplayGroup(array('Param999', 'Param1', 'Param2'), 'parameters');
$parameters = $this->getDisplayGroup('parameters');
}
开发者ID:anunay,项目名称:stentors,代码行数:33,代码来源:FormBlockGallery.php
示例2: Tree
public static function Tree($level)
{
// call this function with level depth u want
$cate = Categories::with(implode('.', array_fill(0, $level, 'children')))->whereparent_id(0)->get();
$new = new Categories();
return $new->treeBuild($cate);
}
开发者ID:om-innctech,项目名称:ila,代码行数:7,代码来源:Categories.php
示例3: __construct
public function __construct($options = null)
{
$baseDir = $options['baseDir'];
$pageID = $options['pageID'];
parent::__construct($options);
/****************************************/
// PARAMETERS
/****************************************/
// select box category (Parameter #1)
$blockCategory = new Zend_Form_Element_Select('Param1');
$blockCategory->setLabel('Catégorie d\'évènement de ce bloc')->setAttrib('class', 'largeSelect');
$categories = new Categories();
$select = $categories->select()->setIntegrityCheck(false)->from('Categories')->join('CategoriesIndex', 'C_ID = CI_CategoryID')->where('C_ModuleID = ?', 7)->where('CI_LanguageID = ?', Zend_Registry::get("languageID"))->order('CI_Title');
$categoriesArray = $categories->fetchAll($select);
foreach ($categoriesArray as $category) {
$blockCategory->addMultiOption($category['C_ID'], $category['CI_Title']);
}
// number of news to show in front-end (Parameter #2)
$at_least_one = new Zend_Validate_GreaterThan('0');
$at_least_one->setMessage('Vous devez afficher au moins un événement.');
$not_null = new Zend_Validate_NotEmpty();
$not_null->setMessage($this->getView()->getCibleText('validation_message_empty_field'));
$blockNewsMax = new Zend_Form_Element_Text('Param2');
$blockNewsMax->setLabel('Nombre d\'évènement à afficher')->setRequired(true)->setValue('1')->addValidator($not_null, true)->addValidator($at_least_one, true)->setAttrib('class', 'smallTextInput');
// show the breif text in front-end (Parameter #3)
$blockShowBrief = new Zend_Form_Element_Checkbox('Param3');
$blockShowBrief->setLabel('Afficher le texte bref');
$blockShowBrief->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
$this->addElements(array($blockCategory, $blockNewsMax, $blockShowBrief));
$this->removeDisplayGroup('parameters');
$this->addDisplayGroup(array('Param999', 'Param1', 'Param2', 'Param3'), 'parameters');
$parameters = $this->getDisplayGroup('parameters');
//$parameters->setLegend($this->_view->getCibleText('form_parameters_fieldset'));
}
开发者ID:anunay,项目名称:stentors,代码行数:34,代码来源:FormBlockEvents.php
示例4: getAllNewsletterCategories
function getAllNewsletterCategories()
{
$categoriesSelect = new Categories();
$select = $categoriesSelect->select()->setIntegrityCheck(false);
$select->from('Categories')->join('CategoriesIndex', ' CI_CategoryID = C_ID')->where('CI_LanguageID = ?', Zend_Registry::get("languageID"))->where('C_ModuleID = 8')->order('CI_Title');
$categoriesData = $categoriesSelect->fetchAll($select);
return $categoriesData;
}
开发者ID:anunay,项目名称:stentors,代码行数:8,代码来源:GetAllNewsletterCategories.php
示例5: buildCategories
private function buildCategories($xml)
{
$categories = new Categories();
$categoryArray = array();
foreach ($xml->Category as $category) {
array_push($categoryArray, (string) $category);
}
$categories->setCategory($categoryArray);
return $categories;
}
开发者ID:vicenteguerra,项目名称:Flashbuy,代码行数:10,代码来源:CategoriesLocalFavoritesService.php
示例6: actionIndex
/**
* Lists all models.
*/
public function actionIndex()
{
$model = new Categories('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['Categories'])) {
$model->attributes = $_GET['Categories'];
}
$model->pageSize = 25;
$this->render('index', array('model' => $model));
}
开发者ID:fandikurnia,项目名称:CiiMS,代码行数:14,代码来源:CategoriesController.php
示例7: insertRel
private function insertRel($value)
{
try {
$this->log->addInfo("Inicia funcion MainProject::insertRel() ");
$categories = new Categories();
$rel = array(0, "lkp_projects", $value->id);
$categories->insert($rel);
} catch (\Excetion $e) {
$this->log->addError($e->getMessage(), array(basename(__FILE__) . "::" . __LINE__));
}
}
开发者ID:javierTerry,项目名称:api-teamwork,代码行数:11,代码来源:MainProject.php
示例8: addCategory
public function addCategory($attr)
{
$model = new Categories();
$model->setAttributes($attr);
$model->status = 1;
$model->created_at = time();
$model->updated_at = time();
if ($model->save(FALSE)) {
return TRUE;
}
return FALSE;
}
开发者ID:huynt57,项目名称:image_chooser,代码行数:12,代码来源:Categories.php
示例9: post
public function post()
{
include_once 'application/models/Categories.php';
$name = $this->request->getPost('name');
if (empty($name)) {
return false;
}
$category = new Categories();
$category->name = $name;
$category->put();
return "/admin/categories/{$category->id}";
}
开发者ID:joksnet,项目名称:php-old,代码行数:12,代码来源:Add.php
示例10: getForm
public function getForm($id = null)
{
$dataAdmin = new PrProviders();
$modelProviders = new PrTypes();
$modelCategories = new Categories();
$listProviders = $modelProviders->where('flagactive', PrTypes::STATE_ACTIVE)->lists('name_type', 'id')->toArray();
$listProviders = [null => 'Select un tipo'] + $listProviders;
$listCategories = $modelCategories->where('flagactive', Categories::STATE_ACTIVE)->lists('name_category', 'id')->toArray();
$listCategories = [null => 'Select una categoria'] + $listCategories;
if (!is_null($id)) {
$dataAdmin = PrProviders::find($id);
}
return viewc('admin.' . self::NAMEC . '.form', compact('dataAdmin', 'listProviders'), ['listCategories' => $listCategories, 'listCategories' => $listCategories]);
}
开发者ID:josmel,项目名称:buen,代码行数:14,代码来源:PublicationComplaintsController.php
示例11: testFindByParentId
function testFindByParentId()
{
global $success, $failure;
$category = new Categories();
if (!isset($category)) {
print "Category is not set";
$failure++;
}
if (($rs = $category->findFindByParentId(0)) === false) {
$failure++;
} else {
rs2html($rs);
$success++;
}
}
开发者ID:nateirwin,项目名称:custom-historic,代码行数:15,代码来源:CategoryTest.php
示例12: setCategoryTitleSmall
private function setCategoryTitleSmall($categoryID = 0)
{
$category = Categories::findFirst($categoryID);
$this->view->h1_small = $category->title;
$this->view->categoryID = $categoryID;
}
开发者ID:Kefir92,项目名称:home-bookkeeping,代码行数:7,代码来源:ElementsController.php
示例13: smarty_function_select_page
/**
* Render select page control
*
* Parameters:
*
* - project - Parent project
* - value - ID of selected page
*
* @param array $params
* @param Smarty $smarty
* @return string
*/
function smarty_function_select_page($params, &$smarty)
{
$project = array_var($params, 'project', null, true);
if (!instance_of($project, 'Project')) {
return new InvalidParamError('project', $project, '$project is expected to be an instance of Project class', true);
}
// if
$user = array_var($params, 'user');
if (!instance_of($user, 'User')) {
return new InvalidParamError('user', $user, '$user is exepcted to be an instance of User class', true);
}
// if
$options = array();
$value = array_var($params, 'value', null, true);
$skip = array_var($params, 'skip');
$categories = Categories::findByModuleSection($project, PAGES_MODULE, 'pages');
if (is_foreachable($categories)) {
foreach ($categories as $category) {
$option_attributes = $category->getId() == $value ? array('selected' => true) : null;
$options[] = option_tag($category->getName(), $category->getId(), $option_attributes);
$pages = Pages::findByCategory($category, STATE_VISIBLE, $user->getVisibility());
if (is_foreachable($pages)) {
foreach ($pages as $page) {
smarty_function_select_page_populate_options($page, $value, $user, $skip, $options, '- ');
}
// foreach
}
// if
}
// foreach
}
// if
return select_box($options, $params);
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:46,代码来源:function.select_page.php
示例14: getCategoryRoute
public static function getCategoryRoute($catid)
{
if ($catid instanceof CategoryNode) {
$id = $catid->id;
$category = $catid;
} else {
$id = (int) $catid;
$category = Categories::getInstance('JFoobars')->get($id);
}
if ($id < 1) {
$link = '';
} else {
$needles = array('category' => array($id));
if ($item = self::_findItem($needles)) {
$link = 'index.php?Itemid=' . $item;
} else {
//Create the link
$link = 'index.php?option=com_jfoobars&view=category&id=' . $id;
if ($category) {
$catids = array_reverse($category->getPath());
$needles = array('category' => $catids, 'categories' => $catids);
if ($item = self::_findItem($needles)) {
$link .= '&Itemid=' . $item;
} elseif ($item = self::_findItem()) {
$link .= '&Itemid=' . $item;
}
}
}
}
return $link;
}
开发者ID:naka211,项目名称:jydsk,代码行数:31,代码来源:route.php
示例15: loadApi
function loadApi($action)
{
switch ($action) {
case 'insert':
if (!isset($_COOKIE['groupid'])) {
throw new Exception("You must be login.");
}
try {
if (!($id = Categories::insert(Request::make('send')))) {
throw new Exception("Error. " . Database::$error);
}
return json_encode(array('error' => 'no'));
} catch (Exception $e) {
throw new Exception($e->getMessage());
}
break;
case 'get':
try {
$data = Categories::get();
return json_encode($data);
} catch (Exception $e) {
throw new Exception($e->getMessage());
}
break;
}
}
开发者ID:neworldwebsites,项目名称:noblessecms,代码行数:26,代码来源:categories.php
示例16: actionIndex
/**
* Lists all models.
*/
public function actionIndex()
{
switch ($_GET['s']) {
case 'Author':
$prof = Profile::model()->with('user', 'AuthAssignment')->findAll();
$cat = Categories::model()->findAll();
foreach ($cat as $key => $val) {
$rescat[$val->getAttributes()['id']] = $val->getAttributes()['cat_name'];
}
foreach ($prof as $key => $val) {
$res = $val->getAttributes();
$res1 = $val->AuthAssignment->getAttributes();
//---<<
$resuser = $val->user->getAttributes();
if ($res['discipline'] != '') {
$res['cat_name'] = implode(',', array_intersect_key($rescat, array_flip(explode(',', $res['discipline']))));
}
if ($res1['itemname'] == 'Author') {
$itog[$key] = array_merge($res, $resuser);
}
}
$dataProvider = new CArrayDataProvider($itog, array('pagination' => array('pageSize' => Yii::app()->controller->module->user_page_size)));
break;
default:
$dataProvider = new CActiveDataProvider('User', array('criteria' => array('condition' => 'status>' . User::STATUS_BANNED, 'with' => array('AuthAssignment' => array('condition' => 'itemname="Customer"', 'together' => true))), 'pagination' => array('pageSize' => Yii::app()->controller->module->user_page_size)));
break;
}
$this->render('/user/index', array('dataProvider' => $dataProvider));
}
开发者ID:rahmanjis,项目名称:dipstart-development,代码行数:32,代码来源:DefaultController.php
示例17: actionIndex
public function actionIndex()
{
$male_cats = Categories::model()->getMaleCategory();
$female_cats = Categories::model()->getFemaleCategory();
$other_cats = Categories::model()->getOtherCategory();
$this->render('index', array('male_cats' => $male_cats, 'female_cats' => $female_cats, 'other_cats' => $other_cats));
}
开发者ID:huynt57,项目名称:image_chooser,代码行数:7,代码来源:UploadController.php
示例18: smarty_function_select_category
/**
* Render select category control
*
* Supported paramteres:
*
* - all HTML attributes
* - project - Parent project, required
* - module - Module
* - controller - Controller name
* - value - ID of selected category
* - optional - If false there will be no -- none -- option
*
* @param array $params
* @param Smarty $smarty
* @return string
*/
function smarty_function_select_category($params, &$smarty)
{
static $ids = array();
$project = array_var($params, 'project', null, true);
if (!instance_of($project, 'Project')) {
return new InvalidParamError('project', $project, 'Project parameter is required for select category helper and it needs to be an instance of Project class', true);
}
// if
$user = array_var($params, 'user', null, true);
$module = trim(array_var($params, 'module', null, true));
if ($module == '') {
return new InvalidParamError('module', $module, 'Module parameter is required for select category helper', true);
}
// if
$controller = trim(array_var($params, 'controller', null, true));
if ($controller == '') {
return new InvalidParamError('controller', $controller, 'Controller parameter is required for select category helper', true);
}
// if
$id = array_var($params, 'id', null, true);
if (empty($id)) {
$counter = 1;
do {
$id = "select_category_{$counter}";
$counter++;
} while (in_array($id, $ids));
}
// if
$params['id'] = $id;
$value = array_var($params, 'value', null, true);
$optional = array_var($params, 'optional', true, true);
$options = array();
if ($optional) {
$options[] = option_tag(lang('-- None --'), '');
}
// if
$categories = Categories::findByModuleSection($project, $module, $controller);
if (is_foreachable($categories)) {
foreach ($categories as $category) {
$option_attributes = array('class' => 'object_option');
if ($category->getId() == $value) {
$option_attributes['selected'] = true;
}
// if
$options[] = option_tag($category->getName(), $category->getId(), $option_attributes);
}
// foreach
}
// if
if (instance_of($user, 'User') && Category::canAdd($user, $project)) {
$params['add_object_url'] = Category::getQuickAddUrl($project, $controller, $module);
$params['object_name'] = 'category';
$params['add_object_message'] = lang('Please insert new category name');
$options[] = option_tag('', '');
$options[] = option_tag(lang('New Category...'), '', array('class' => 'new_object_option'));
}
// if
return select_box($options, $params) . '<script type="text/javascript">$("#' . $id . '").new_object_from_select();</script>';
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:75,代码来源:function.select_category.php
示例19: layout
/**
* list categories
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// process all items in the list
$items = array();
$total = 0;
$minimum = 10000;
$maximum = 0;
while ($item = SQL::fetch($result)) {
// this will be sorted alphabetically
$items[$item['title']] = array('importance' => (int) $item['importance'], 'href' => Categories::get_permalink($item));
// assess the scope
if ($minimum > (int) $item['importance']) {
$minimum = (int) $item['importance'];
}
if ($maximum < (int) $item['importance']) {
$maximum = (int) $item['importance'];
}
}
// end of processing
SQL::free($result);
// sort the array alphabetically
ksort($items);
// scale items
$text = '';
foreach ($items as $title => $item) {
switch ((string) ceil((1 + $item['importance'] - $minimum) * 6 / (1 + $maximum - $minimum))) {
default:
case 1:
$item['style'] = 'font-size: 0.8em';
break;
case 2:
$item['style'] = 'font-size: 0.9em';
break;
case 3:
$item['style'] = 'font-size: 1.3em';
break;
case 4:
$item['style'] = 'font-size: 1.5em';
break;
case 5:
$item['style'] = 'font-size: 1.7em';
break;
case 6:
$item['style'] = 'font-size: 2em';
break;
}
$text .= '<span style="' . $item['style'] . '">' . Skin::build_link($item['href'], $title, 'basic') . '</span> ';
}
// final packaging
$text = '<p class="cloud">' . rtrim($text) . '</p>';
// return by reference
return $text;
}
开发者ID:rair,项目名称:yacs,代码行数:67,代码来源:layout_categories_as_cloud.php
示例20: run
public function run()
{
$faker = Faker\Factory::create();
//Categories::truncate();
for ($i = 0; $i < 10; $i++) {
$category = Categories::create(array('name' => $faker->word, 'description' => $faker->text));
}
}
开发者ID:jmrodriguesgoncalves,项目名称:NewTownCabinetry,代码行数:8,代码来源:CategoriesTableSeeder.php
注:本文中的Categories类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论