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


PHP DataGrid::addDateColumn方法代码示例

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


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

示例1: createComponentDataGrid

 /**
  * Component factory.
  * @see Nette/ComponentContainer#createComponent()
  */
 protected function createComponentDataGrid($name)
 {
     $grid = new DataGrid();
     $grid->bindDataTable(dibi::getConnection()->dataSource('SELECT
     workId as id,        
     title,
     CONCAT_WS(" ", name, surname) as authorName,
     award,
     year,
     type,
     pages,
     added,
     edited
     FROM [works] 
     join [authors] on author = authorId', 'WHERE %and', $this->where));
     $grid->addActionColumn('Akce');
     $grid->addColumn('title', 'Název', 50)->addDefaultSorting('asc');
     if (!isset($this->where['authorId'])) {
         $grid->addColumn('authorName', 'Autor');
     }
     $grid->addNumericColumn('year', 'Ročník')->getCellPrototype()->style('min-width: 75px;');
     $grid->addDateColumn('added', 'Vytvořena', '%d.%m.%Y');
     $grid->addDateColumn('edited', 'Upravena', '%H:%M:%S %d.%m.%Y')->getCellPrototype()->style('white-space: nowrap;');
     $grid->addColumn('award', 'Cena');
     $grid->addColumn('type', 'Typ');
     $grid->addNumericColumn('pages', 'Stran')->getCellPrototype()->style('text-align: right;')->class = 'pages';
     $grid->keyName = 'id';
     $grid->addAction('Smazat', 'delete!', NULL, FALSE, DataGridAction::WITH_KEY);
     if ($this->advanced) {
         $grid['title']->addFilter();
         $grid['authorName']->addFilter();
         $grid['year']->addSelectboxFilter();
         $grid['award']->addSelectboxFilter();
         $grid['type']->addSelectboxFilter();
         $grid['type']->addSelectboxFilter();
         $grid['added']->addDateFilter();
         $grid['edited']->addDateFilter();
         if (isset($grid['pages'])) {
             $grid['pages']->addSelectboxFilter();
         }
     }
     //$grid->itemsPerPage = ;
     $grid->multiOrder = FALSE;
     $grid->itemsPerPage = $this->getCookiesItemsCount(15);
     $renderer = $grid->getRenderer();
     $renderer->paginatorFormat = '%label% %input% z %count%';
     $renderer->infoFormat = 'Práce %from% - %to% z %count% | Zobrazit: %selectbox% | %reset%';
     $renderer->onRowRender[] = array($this, 'worksOnRowRendered');
     if (!$grid->paginator->itemCount) {
         $renderer->wrappers['form']['.class'] .= " hidden";
     }
     //$grid->rememberState = TRUE;
     $this->addComponent($grid, $name);
     return;
 }
开发者ID:xixixao,项目名称:chytrapalice,代码行数:59,代码来源:WorkList.php

示例2: createComponentPagesGrid

 public function createComponentPagesGrid($name)
 {
     $grid = new DataGrid($this, $name);
     $grid->rememberState = TRUE;
     // povolí ukládání stavů komponenty do session
     $grid->timeout = '+ 7 days';
     $ds = $this->model('Pages')->getDs();
     $grid->bindDataTable($ds);
     $grid->keyName = 'title';
     $grid->addColumn('homepage', '');
     $grid['homepage']->getHeaderPrototype()->class('homepage-column');
     $grid['homepage']->getCellPrototype()->class('homepage-column');
     $grid['homepage']->formatCallback[] = array($this, 'homepageCallback');
     //$grid['creditLimit']->getCellPrototype()->style('text-align: center');
     $grid->addColumn('title', 'Title')->addFilter();
     $categories = $this->model('categories')->getPairs();
     $grid->addColumn('category', 'Category')->addSelectboxFilter($categories);
     $this->categories = array('0' => 'none') + $categories;
     $grid['category']->formatCallback[] = array($this, 'gridCategoryCallback');
     $grid['title']->formatCallback[] = array($this, 'createLink');
     $grid->addColumn('template', 'Template')->addSelectboxFilter();
     $grid['template']->getCellPrototype()->style('text-align: center');
     $grid['template']->formatCallback[] = array($this, 'templateFormatCallback');
     $grid->addColumn('published', 'Published')->addSelectboxFilter(array('0' => "No", '1' => "Yes"), TRUE);
     $grid['published']->getCellPrototype()->style('text-align: center');
     $grid['published']->formatCallback[] = array($this, 'publishFormatCallback');
     $grid->addDateColumn('publish_time', 'Publish time', '%d.%m.%Y %H:%M:%S');
     $grid['publish_time']->getHeaderPrototype()->style('text-align: center');
     $grid['publish_time']->getCellPrototype()->style('text-align: center');
     $grid->addActionColumn('Actions');
     $grid->addAction('Edit', 'editPage!', Html::el('span')->class('icon icon-edit'), $useAjax = TRUE);
     $grid->addAction('Delete', 'confirmForm:confirmDelete!', Html::el('span')->class('icon icon-delete'), $useAjax = TRUE);
     $renderer = $grid->getRenderer();
     $renderer->paginatorFormat = '%input%';
     $grid->setRenderer($renderer);
     return $grid;
 }
开发者ID:bazo,项目名称:Mokuji,代码行数:37,代码来源:AdminPagesPresenter.php

示例3: createComponentOrdersGrid

 protected function createComponentOrdersGrid()
 {
     $model = new DatagridModel();
     $grid = new DataGrid();
     $translator = new GettextTranslator(Environment::expand('%templatesDir%/customersGrid.cs.mo'));
     $grid->setTranslator($translator);
     $renderer = new DataGridRenderer();
     $renderer->paginatorFormat = '%input%';
     // customize format of paginator
     $renderer->onCellRender[] = array($this, 'ordersGridOnCellRendered');
     $grid->setRenderer($renderer);
     $grid->itemsPerPage = 10;
     // display 10 rows per page
     $grid->displayedItems = array('all', 10, 20, 50);
     // items per page selectbox items
     $grid->rememberState = TRUE;
     $grid->timeout = '+ 7 days';
     // change session expiration after 7 days
     $grid->bindDataTable($model->getOrdersInfo());
     $grid->multiOrder = FALSE;
     // order by one column only
     $operations = array('delete' => 'delete', 'deal' => 'deal', 'print' => 'print', 'forward' => 'forward');
     // define operations
     // in czech for example: $operations = array('delete' => 'smazat', 'deal' => 'vyřídit', 'print' => 'tisk', 'forward' => 'předat');
     // or you can left translate values by translator adapter
     $callback = array($this, 'gridOperationHandler');
     $grid->allowOperations($operations, $callback, 'orderNumber');
     // allows checkboxes to do operations with more rows
     /**** add some columns ****/
     $grid->addColumn('customerName', 'Customer');
     $grid->addColumn('addressLine1', 'Address')->getHeaderPrototype()->addStyle('width: 180px');
     $grid->addColumn('city', 'City');
     $grid->addColumn('country', 'Country');
     $caption = Html::el('span')->setText('P')->title('Number of products on order')->class('link');
     $grid->addNumericColumn('productsCount', $caption)->getCellPrototype()->addStyle('text-align: center');
     $grid->addDateColumn('orderDate', 'Date', '%m/%d/%Y');
     // czech format: '%d.%m.%Y'
     $grid->addColumn('status', 'Status');
     $grid->addColumn('creditLimit', 'Credit')->getCellPrototype()->addStyle('text-align: center');
     /**** add some filters ****/
     $grid['customerName']->addFilter();
     $grid['addressLine1']->addFilter();
     $grid['city']->addSelectboxFilter()->translateItems(FALSE);
     $grid['country']->addSelectboxFilter()->translateItems(FALSE);
     $grid['productsCount']->addFilter();
     $grid['orderDate']->addDateFilter();
     $grid['status']->addSelectboxFilter();
     $grid['creditLimit']->addFilter();
     /**** default sorting and filtering ****/
     $grid['orderDate']->addDefaultSorting('desc');
     $grid['productsCount']->addDefaultFiltering('>2');
     /**** column content affecting ****/
     // by css styling
     $grid['orderDate']->getCellPrototype()->addStyle('text-align: center');
     $grid['status']->getHeaderPrototype()->addStyle('width: 60px');
     $grid['addressLine1']->getHeaderPrototype()->addStyle('width: 150px');
     $grid['city']->getHeaderPrototype()->addStyle('width: 90px');
     // by replacement of given pattern
     $el = Html::el('span')->addStyle('margin: 0 auto');
     $grid['status']->replacement['Shipped'] = clone $el->class("icon icon-shipped")->title("Shipped");
     $grid['status']->replacement['Resolved'] = clone $el->class("icon icon-resolved")->title("Resolved");
     $grid['status']->replacement['Cancelled'] = clone $el->class("icon icon-cancelled")->title("Cancelled");
     $grid['status']->replacement['On Hold'] = clone $el->class("icon icon-hold")->title("On Hold");
     $grid['status']->replacement['In Process'] = clone $el->class("icon icon-process")->title("In Process");
     $grid['status']->replacement['Disputed'] = clone $el->class("icon icon-disputed")->title("Disputed");
     $grid['status']->replacement[''] = clone $el->class("icon icon-no-orders")->title("Without orders");
     // by callback(s)
     $grid['creditLimit']->formatCallback[] = 'Helpers::currency';
     /**** add some actions ****/
     $grid->addActionColumn('Actions')->getHeaderPrototype()->addStyle('width: 98px');
     $icon = Html::el('span');
     $grid->addAction('Copy', 'Customer:copy', clone $icon->class('icon icon-copy'));
     $grid->addAction('Detail', 'Customer:detail', clone $icon->class('icon icon-detail'));
     $grid->addAction('Edit', 'Customer:edit', clone $icon->class('icon icon-edit'));
     $grid->addAction('Delete', 'Customer:delete', clone $icon->class('icon icon-del'));
     return $grid;
 }
开发者ID:romansklenar,项目名称:nette-datagrid,代码行数:77,代码来源:ExamplePresenter.php


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