Exemplo n.º 1
0
 private function confPage()
 {
     $em = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
     //create Page
     $page = new Page($em, 1, new DekaAddresses(), 'Inventory\\Entity\\DekaAddresses');
     $url1 = new Url('Test1', 'index');
     $url2 = new Url('Test2', 'view');
     $page->setUrls(array($url1, $url2));
     /*
     //Page 1
     $widgetTable = new WidgetTable($em, 1, $this->params()->fromQuery('addr_page', 1), 'addr', new DekaAddresses, 'Inventory\Entity\DekaAddresses');
     
     $col = new Col();
     $col->addWidget($widgetTable);
     
     $row = new Row();
     $row->addCol($col);
     
     $dashboard = new Dashboard();
     $dashboard->setId("1");
     $dashboard->setName("Адреса");
     $dashboard->setUrl("index");
     $dashboard->addRow($row);
     
     
     //Page2
     $request = $this->getRequest();
             if ($request->isPost()) {
     	$post = $request->getPost();
             }
             
     $widgetView = new WidgetView($em, $this->params()->fromRoute('id',1), 'addr_view', 'edit', new DekaAddresses, 'Inventory\Entity\DekaAddresses');
     $widgetView->setPost($post);
     
     $col2 = new Col();
     $col2->addWidget($widgetView);
     
     $row2 = new Row();
     $row2->addCol($col2);
     
     $dashboard2 = new Dashboard();
     $dashboard2->setId("2");
     $dashboard2->setName("Параметры");
     $dashboard2->setUrl("view");
     $dashboard2->addRow($row2);
     
     $page->setDashboards(array('1' => $dashboard, '2' => $dashboard2));
     */
     return $page;
 }
Exemplo n.º 2
0
 public function __invoke(PageModel $page)
 {
     $myRoute = $this->getView()->getHelperPluginManager()->getServiceLocator()->get('application')->getMvcEvent()->getRouteMatch()->getMatchedRouteName();
     /*foreach ($page->getDashboards() as $key => $element){
             if ($key == $page->getActiveDashboard()) {
                 $activeDashboard = ' btn-primary';
             } else {
                 $activeDashboard = '';
             }
             $dashboards .= '<!-- Content Col --><div class="btn-group"><a class="btn btn-default btn-sm'.$activeDashboard.'" style="border-radius: 25px!important;" href="'
             .$this->getView()->url($myRoute, array('controller'=>$myRoute, 'action'=>$element->geturl()), array('query' => array($this->name.'ad_page' => $element->getId()))).'">'.$element->getName().'</a></div>
       <!-- /.col -->';
         }*/
     foreach ($page->getUrls() as $key => $element) {
         if ($key == $page->getActivePage()) {
             $activeDashboard = ' btn-primary';
         } else {
             $activeDashboard = '';
         }
         $dashboards .= '<!-- Content Col --><div class="btn-group"><a class="btn btn-default btn-sm' . $activeDashboard . '" style="border-radius: 25px!important;" href="' . $this->getView()->url($myRoute, array('controller' => $myRoute, 'action' => $element->getUrl())) . '">' . $element->getName() . '</a></div>
   <!-- /.col -->';
     }
     foreach ($page->getDashboard()->getRows() as $element) {
         $rows .= $this->getView()->row_helper($element);
     }
     $html .= '<!-- Content Header (Page header) -->
 <section class="content-header">
   <h1>
     ' . $page->getName() . '
     <small>Version 2.0</small>
   </h1>
   <ol class="breadcrumb">
     <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
     <li class="active">Dashboard</li>
   </ol>
     <div class="row">
         <div class="col-xs-12">' . $dashboards . '</div>
     </div>
 </section>
 <!-- Main content -->
 <section class="content">' . $rows . '</section>
 <!-- /.content -->';
     return $html;
 }