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


PHP Category::getAll方法代码示例

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


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

示例1: edit

 /**
  * Создание категории
  */
 public function edit($id)
 {
     if (!User::isAdmin()) {
         App::abort('403');
     }
     if (!($category = Category::find_by_id($id))) {
         App::abort('default', 'Категория не найдена!');
     }
     if (Request::isMethod('post')) {
         $category->token = Request::input('token', true);
         $category->parent_id = Request::input('parent_id');
         $category->name = Request::input('name');
         $category->slug = Request::input('slug');
         $category->description = Request::input('description');
         $category->sort = Request::input('sort');
         if ($category->save()) {
             App::setFlash('success', 'Категория успешно изменена!');
             App::redirect('/category');
         } else {
             App::setFlash('danger', $category->getErrors());
             App::setInput($_POST);
         }
     }
     $categories = Category::getAll();
     App::view('categories.edit', compact('category', 'categories'));
 }
开发者ID:visavi,项目名称:rotorcms,代码行数:29,代码来源:CategoryController.php

示例2: make

 public function make()
 {
     $values = array(Zurmo::t('CustomField', 'Labor'), Zurmo::t('CustomField', 'Equipment'), Zurmo::t('CustomField', 'Material'), Zurmo::t('CustomField', 'Subcontractor'), Zurmo::t('CustomField', 'Other'), Zurmo::t('CustomField', 'Assembly'));
     static::makeCustomFieldDataByValuesAndDefault('CostOfGoodsTypes', $values);
     $values = array(Zurmo::t('CustomField', 'All'), Zurmo::t('CustomField', 'Labor'), Zurmo::t('CustomField', 'Equipment'), Zurmo::t('CustomField', 'Material'), Zurmo::t('CustomField', 'Subcontractor'), Zurmo::t('CustomField', 'Other'));
     static::makeCustomFieldDataByValuesAndDefault('CostOfGoodsTypesAssembly', $values, $values[0]);
     $unitofMeasuresDropdownOptions = array();
     foreach (Unitofmeasure::getAll('name') as $uom) {
         $unitofMeasuresDropdownOptions[] = Zurmo::t('CustomField', $uom->name);
     }
     static::makeCustomFieldDataByValuesAndDefault('UnitOfMeasureTypes', $unitofMeasuresDropdownOptions);
     $categoriesDropdownOptions = array();
     foreach (Category::getAll('name') as $categroy) {
         $categoriesDropdownOptions[] = Zurmo::t('CustomField', $categroy->name);
     }
     static::makeCustomFieldDataByValuesAndDefault('CategoryTypes', $categoriesDropdownOptions);
     $assemblyDetailvalues = Costbook::getAllAssemblyDetails();
     $assemblyDetailDropdownOptions = array();
     foreach ($assemblyDetailvalues as $assemblyDetail) {
         if ($assemblyDetail['assemblydetail'] != NULL) {
             $tmpAssemblyoptions = explode(";", $assemblyDetail['assemblydetail']);
             foreach ($tmpAssemblyoptions as $assemblyOption) {
                 $assemblyDetailDropdownOptions[] = Zurmo::t('CustomField', $assemblyOption);
             }
         }
     }
     static::makeCustomFieldDataByValuesAndDefault('AssemblyDetailSearchTypes', $assemblyDetailDropdownOptions);
 }
开发者ID:RamaKavanan,项目名称:BaseVersion,代码行数:28,代码来源:CostbooksDefaultDataMaker.php

示例3: find

 static function find($searchId)
 {
     $categories_returned = Category::getAll();
     foreach ($categories_returned as $category) {
         if ($searchId == $category->getId()) {
             return $category;
         }
     }
 }
开发者ID:jtorrespdx,项目名称:walk_ins_welcome,代码行数:9,代码来源:Category.php

示例4: actionModify

 /**
  * 添加、修改文章
  */
 public function actionModify($id)
 {
     $id = (int) $id;
     $where = array('a.aid' => $id);
     $Articles = new Articles();
     $Category = new Category();
     $this->data = $Articles->select('c.*,a.*')->from('articles a')->join('articles_content c', 'a.aid=c.aid')->where($where)->getOne();
     $this->data['content'] = stripslashes($this->data['content']);
     $this->category = $Category->getAll();
 }
开发者ID:mamtou,项目名称:wavephp,代码行数:13,代码来源:ArticlesController.php

示例5: test_deleteAll

 function test_deleteAll()
 {
     $name = "Wash the dog";
     $name2 = "Home stuff";
     $test_Category = new Category($name);
     $test_Category->save();
     $test_Category2 = new Category($name2);
     $test_Category2->save();
     Category::deleteAll();
     $result = Category::getAll();
     $this->assertEquals([], $result);
 }
开发者ID:bdspen,项目名称:todo_database,代码行数:12,代码来源:CategoryTest.php

示例6: find

 static function find($search_id)
 {
     $found_category = null;
     $categories = Category::getAll();
     foreach ($categories as $category) {
         $category_id = $category->getId();
         if ($category_id == $search_id) {
             $found_category = $category;
         }
     }
     return $found_category;
 }
开发者ID:jmalo34,项目名称:ToDoList_MySQL,代码行数:12,代码来源:Category.php

示例7: renderCategories

function renderCategories($startingId, $parentId = null)
{
    $categories = Category::getAll($startingId ? array('id' => $startingId) : array('parent_id' => $parentId));
    if (!empty($categories)) {
        echo '<ul>';
        foreach ($categories as $category) {
            echo '<li><a href="/?c=' . $category->id . '">' . $category->name . '</a></li>';
            renderCategories(null, $category->id);
        }
        echo '</ul>';
    }
}
开发者ID:mrDumay,项目名称:demoshop,代码行数:12,代码来源:part_sitemap.php

示例8: test_getAll

 function test_getAll()
 {
     //Arrange
     $name = "Work stuff";
     $name2 = "Home stuff";
     $test_category = new Category($name);
     $test_category->save();
     $test_category2 = new Category($name2);
     $test_category2->save();
     //Act
     $result = Category::getAll();
     //Assert
     $this->assertEquals([$test_category, $test_category2], $result);
 }
开发者ID:jtorrespdx,项目名称:ToDo,代码行数:14,代码来源:CategoryTest.php

示例9: create

 /**
  * Создание новости
  */
 public function create()
 {
     if (!User::isAdmin()) {
         App::abort('403');
     }
     if (Request::isMethod('post')) {
         $news = new News();
         $news->category_id = Request::input('category_id');
         $news->user_id = User::get('id');
         $news->title = Request::input('title');
         $news->slug = '';
         $news->text = Request::input('text');
         $image = Request::file('image');
         if ($image && $image->isValid()) {
             $ext = $image->getClientOriginalExtension();
             $filename = uniqid(mt_rand()) . '.' . $ext;
             if (in_array($ext, ['jpeg', 'jpg', 'png', 'gif'])) {
                 $img = new SimpleImage($image->getPathName());
                 $img->best_fit(1280, 1280)->save('uploads/news/images/' . $filename);
                 $img->best_fit(200, 200)->save('uploads/news/thumbs/' . $filename);
             }
             $news->image = $filename;
         }
         if ($news->save()) {
             if ($tags = Request::input('tags')) {
                 $tags = array_map('trim', explode(',', $tags));
                 foreach ($tags as $tag) {
                     $tag = Tag::create(['name' => $tag]);
                     $tag->create_news_tags(['news_id' => $news->id]);
                 }
             }
             App::setFlash('success', 'Новость успешно создана!');
             App::redirect('/' . $news->category->slug . '/' . $news->slug);
         } else {
             App::setFlash('danger', $news->getErrors());
             App::setInput($_POST);
         }
     }
     $categories = Category::getAll();
     App::view('news.create', compact('categories'));
 }
开发者ID:visavi,项目名称:rotorcms,代码行数:44,代码来源:NewsController.php

示例10: getSelect

 function getSelect()
 {
     $results = Category::getAll("title");
     foreach ($results as $row) {
         $temp[] = array("value" => $row['id'], "label" => stripslashes($row['title']));
     }
     return $temp;
 }
开发者ID:npedrini,项目名称:anthroposts,代码行数:8,代码来源:category.class.php

示例11: printBoardContent

 public function printBoardContent($user, $con)
 {
     global $permission;
     $printContent = "<div class='board'><div class=\"forum_menu\">";
     if ($user->hasPermission($permission["board_edit"], $this)) {
         $printContent .= "<a href=\"javascript:void(0)\" data-forum-target='{$this->getID()}' class='board_edit btn_small btn_white btn_flat'>Edit</a> ";
         $moderators .= "<span class='hidden_field'>Moderators: <input type='text' id='moderators_{$this->getID()}' value='{$this->getModeratorsAsString($con)}'></span>";
     }
     if ($user->hasPermission($permission["thread_create"], $this)) {
         $printContent .= "<a href=\"javascript:void(0)\" onclick = \"lightBox('newThread')\" class=\"btn_small btn_white btn_flat\">+ Thread </a> ";
     }
     if ($user->hasPermission($permission["board_create"], $this)) {
         $printContent .= "<a href=\"javascript:void(0)\" data-forum-target='{$this->getID()}' class=\"new_board_button btn_small btn_white btn_flat\">+ Board</a> ";
     }
     if ($user->hasPermission($permission["board_delete"], $this)) {
         $printContent .= "<a href=\"javascript: if(confirm('Delete Board and ALL content within?')) {window.location='{$_SERVER['PHP_SELF']}?d=b{$this->getID()}'}\" class=\"btn_small btn_white btn_flat\">Delete</a>";
     }
     if ($user->hasPermission($permission["board_move"], $this->getParent())) {
         $move = "<span class='hidden_field'>Move:<select id='move_{$this->getID()}'>";
         $move .= "<option value='-1'>--</option>";
         $categories = Category::getAll($con);
         foreach ($categories as $category) {
             if ($category != null) {
                 $move .= "<option value='c{$category->getID()}'>{$category->name}</option>";
                 foreach ($category->getChildren() as $board) {
                     $move .= "<option value='b{$board->getID()}'> - {$board->name}</option>";
                     foreach ($board->getAllSubBoards($con) as $subBoard) {
                         $indent = " -";
                         foreach ($subBoard->getAllParents($con) as $parent) {
                             $indent .= " -";
                         }
                         $move .= "<option value='b{$subBoard->getID()}'>{$indent} {$subBoard->name}</option>";
                     }
                 }
             }
         }
         $move .= "</select></span>";
     }
     $printContent .= "\r\n\t\t</div>\r\n\t\t<h2 class='editable_title header_title' id='board_title_{$this->getID()}'>{$this->name}</h2>\r\n\t\t<div class='editable_title' id='board_description_{$this->getID()}'>{$this->fields["Description"]}</div>\r\n\t\t{$moderators} {$move}\r\n\t\t<div class='clear'></div>\r\n\t\t<div class='elements_container'>" . $this->getTreeAsString();
     if ($user->hasPermission($permission["board_create"], $this)) {
         $printContent .= $this->printNewBoardForm();
     }
     if (count($this->getChildren()) > 0) {
         foreach ($this->getChildren() as $child) {
             if ($child instanceof Board) {
                 $printContent .= $child->printBoard($user);
             }
         }
         $printContent .= "<div class='clear'></div></div><div class='elements_container'>";
         foreach ($this->getChildren() as $child) {
             if ($child instanceof Thread) {
                 $printContent .= $child->printThread($user);
             }
         }
     } else {
         $printContent .= "<div class='forum_element'>No threads and boards avaliable.</div>";
     }
     $printContent .= $this->getTreeAsString() . "<div class='clear'></div></div></div>";
     return $printContent;
 }
开发者ID:shauncjones,项目名称:Simple-Forum,代码行数:60,代码来源:board.php

示例12: testDeleteAll

 function testDeleteAll()
 {
     //Arrange
     $name = "Wash the dog";
     $id = 1;
     $test_category = new Category($name, $id);
     $test_category->save();
     $name2 = "Water the lawn";
     $id2 = 2;
     $test_category2 = new Category($name2, $id2);
     $test_category2->save();
     //Act
     Category::deleteAll();
     //Assert
     $result = Category::getAll();
     $this->assertEquals([], $result);
 }
开发者ID:jtorrespdx,项目名称:to_do,代码行数:17,代码来源:CategoryTest.php

示例13: function

// and a function that gives our route access to the app variable. the method then
// creates a new task object based on the data it receives from the form, and then
// saves (or pushes) the new object onto the $_SESSION array. then the method returns
// the app object (using twig) to call the render method (which receives a file path that
// contains the twig template and an array that contains the new task object, which is
// added to the list)
$app->post("/tasks", function () use($app) {
    $task = new Task($_POST['description']);
    $task->save();
    // return $app['twig']->render('create_task.html.twig', array('newtask' => $task));
    return $app['twig']->render('tasks.html.twig', array('tasks' => Task::getAll()));
});
// calls the post method on the $app object and receives a URL path as its first argument,
// and a function that gives our route access to the app variable. the method then calls
// the Task class method deleteAll(), which resets the $_SESSION array to a blank array.
// then the method returns the app object (using twig) and calls the render method (which
// receives a file path that contains the twig template)
$app->post("/delete_tasks", function () use($app) {
    Task::deleteAll();
    return $app['twig']->render('index.html.twig');
});
$app->post("/categories", function () use($app) {
    $category = new Category($_POST["name"]);
    $category->save();
    return $app["twig"]->render("categories.html.twig", array("categories" => Category::getAll()));
});
$app->post("/delete_categories", function () use($app) {
    Category::deleteAll();
    return $app["twig"]->render("index.html.twig");
});
return $app;
开发者ID:bdspen,项目名称:todo_database,代码行数:31,代码来源:app.php

示例14:

     <div class="content_item">
        <h2>Postavljanje nove vesti</h2>
        <form class="form" method="post" action="publishnews.php" id="newsForm">
          <label>Naslov:</label><br><input type="text" name="tb_title"><br>
          <label>Podnaslov:</label><br><textarea rows="5" cols="90" name="ta_sub_title" form="newsForm"></textarea><br><br>
          <label>Kategorija : </label><select name="sel_category">
          								<?php 
$newsCat = Category::getAll();
foreach ($newsCat as $value) {
    echo "<option value='{$value->category_id}'>" . $value->name . "</option>";
}
?>
      								</select><br><br>	
          <label>Tekst vesti:</label><br><textarea rows="20" cols="90" name="ta_news" form="newsForm"></textarea><br>	
          <input id="btn" type="submit" value="Postavi vest" name="btn_submit">
        </form>

      </div><!--close content_item-->
        <br style="clear:both"/> 
      </div><!--close content-->    
开发者ID:jeffsouln,项目名称:OutdoorSerbia,代码行数:20,代码来源:writeNews.php

示例15: renderContent

 public function renderContent()
 {
     $categories = Category::getAll();
     $data = Costbook::getById($_GET['id']);
     $vAssemblyDetails = '';
     $assembly_count = 0;
     if ($data->assemblydetail != '' && $data->assemblydetailsearch == '(None)') {
         $vAssemblyDetails = explode(';', $data->assemblydetail);
     } else {
         if ($data->assemblydetail == '' && $data->assemblydetailsearch != '(None)') {
             $vAssemblyDetails = explode(', ', $data->assemblydetailsearch);
         } else {
             if ($data->assemblydetail != '' && $data->assemblydetailsearch != '(None)') {
                 $assembly_details = explode(';', $data->assemblydetail);
                 $vAssemblySearchDetails = explode(', ', $data->assemblydetailsearch);
                 $vAssemblyDetails = array_unique(array_merge($assembly_details, $vAssemblySearchDetails));
             }
         }
     }
     $assembly_count = count($vAssemblyDetails);
     $url = Yii::app()->createUrl("costbook/default/getDataAssemblySearch");
     $content = '<div class="SecuredEditAndDetailsView EditAndDetailsView DetailsView ModelView ConfigurableMetadataView MetadataView" id="CostbookEditAndDetailsView">
                         <div class="wrapper">
                             <h1>
                                 <span class="truncated-title" threedots="Create Costbook"><span class="ellipsis-content">Step 2 of 3 - Assembly Detail</span></span>
                             </h1>
                             <div class="wide form">
                             <form method="post" action="/app/index.php/costbook/default/create?clearCache=1&amp;resolveCustomData=1" id="edit-form" onsubmit="js:return $(this).attachLoadingOnSubmit(&quot;edit-form&quot;)">
                                 <input type="hidden" id="hidModelId" name="hidModelId" value="' . $_GET['id'] . '" />
                                 <input type="hidden" name="hidUOM" id="hidUOM" value="' . $data->unitofmeasure . '" />
                                     <div class="attributesContainer">
                                         <div class="left-column" style="width:100%;">
                                             <div class="border_top_In_Assembly_Detail_Level">
                                                 <div class="costBookAssemblyStep2Header" >Detail Products</div>
                                                     <table width=100% class="items" id="detail_products">
                                                         <th width=15%>Product Code</th><th width=30%>Product Name</th><th width=15%>Ratio</th><th width=20%>Base Unit of Measure</th><th width=20%>Unit of Measure</th>';
     if ($vAssemblyDetails != '') {
         for ($i = 0; $i < $assembly_count; $i++) {
             $str = explode('|', $vAssemblyDetails[$i]);
             $dataProductCode = Costbook::getByProductCode($str[1]);
             $content .= '<tr>
                                                             <td >' . $str[1] . '<input type="hidden" id="hidProductCode' . $i . '" value="' . $str[1] . '" /></td>
                                                             <td >' . $dataProductCode[0]->productname . '</td>
                                                             <td ><input type="text" id="detail_ratio' . $i . '" name="detailRatio" value="' . $str[2] . '" style="width:120px;" /></td>
                                                             <td >' . $dataProductCode[0]->unitofmeasure . '</td>
                                                             <td >per ' . $data->unitofmeasure . '<input type="hidden" name="currAssemblyCnt" id="currAssemblyCnt" value="' . $assembly_count . '" /></td>
                                                         </tr>';
         }
     }
     $content .= '</table><br>
                                                 </div>
                                                 <div class="panel border_top_In_Assembly_Detail_Level">
                                                     <div class="costBookAssemblyStep2Header">Search</div>
                                                         <table class="form-fields items" id="costBookAssemblyStep2Headerid">
                                                             <colgroup><col class="col-0"><col class="col-1"></colgroup>
                                                             <tbody>
                                                                 <tr>
                                                                     <th><label for="Costbook_assemblycategory_value">Select Category</label></th>
                                                                     <td colspan="1">
                                                                         <div class="hasDropDown">
                                                                             <span class="select-arrow"></span>
                                                                                 <select id="Costbook_assemblycategory_value" name="Costbook[assemblycategory][value]">
                                                                                     <option value="All">All</option>';
     foreach ($categories as $values) {
         $content .= '<option value="' . $values->name . '">' . $values->name . '</option>';
     }
     $content .= '</select>
                                                                         </div>
                                                                     </td>
                                                                 </tr>
                                                                 <tr>
                                                                     <th>
                                                                         <label for="costofgoodssoldassembly">Select COGS</label>
                                                                     </th>
                                                                     <td colspan="1">
                                                                         <div class="hasDropDown">
                                                                             <span class="select-arrow"></span>
                                                                             <select id="Costbook_costofgoodssoldassembly_value" name="Costbook[costofgoodssoldassembly][value][assemblycategory][value]">
                                                                                 <option selected="selected" value="All">All</option>
                                                                                 <option value="Labor">Labor</option>
                                                                                 <option value="Equipment">Equipment</option>
                                                                                 <option value="Material">Material</option>
                                                                                 <option value="Subcontractor">Subcontractor</option>
                                                                                 <option value="Other">Other</option>			
                                                                             </select>
                                                                         </div>
                                                                     </td>
                                                                 </tr>
                                                                 <tr>
                                                                     <td></td>
                                                                     <td colspan="1">
                                                                         <a id="saveyt2" class="attachLoading cancel-button" name="Search" href="#"  style="margin-left:21.7%;">
                                                                             <span class="z-spinner"></span>
                                                                             <span class="z-icon"></span>
                                                                             <span class="z-label">Search</span>
                                                                         </a>
                                                                     </td>
                                                                 </tr>
                                                             </tbody>
                                                         </table>
//.........这里部分代码省略.........
开发者ID:RamaKavanan,项目名称:BaseVersion,代码行数:101,代码来源:CostbookAssemblyStepView.php


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