<commit_before><?php
/**
 * Created by PhpStorm.
 * User: trisatria
 * Date: 1/6/14
 * Time: 1:17 PM
 */
namespace Admin\Controller;

use Velacolib\Utility\Table;
use Velacolib\Utility\Table\AjaxTable;
use Velacolib\Utility\Table\Detail;

use Admin\Entity\Categories;
use Admin\Entity\Managetable;
use Admin\Model\categoryModel;
use Admin\Model\comboModel;
use Admin\Model\menuModel;
use Velacolib\Utility\Utility;
use Zend\View\Model\ViewModel;
use Zend\Mvc\Controller\AbstractActionController;


class ComboController extends AdminGlobalController
{
    protected   $modelCombo;
    protected   $modelMenu;
    protected  $translator;


    public function init(){
        parent::init();
        $this->modelCombo = new comboModel($this->doctrineService);
        $this->modelMenu = new menuModel($this->doctrineService);

    }


    public function indexAction()
    {

        $columns = array(

            array('title' =>'ID', 'db' => 'id', 'dt' => 0,'search'=>false, 'type' => 'number' ),
            array('title' =>'Name', 'db' => 'menu_parent_id','dt' => 1, 'search'=>true, 'type' => 'text' ),

            array('title' =>'Quantity', 'db' => 'menu_quantity','dt' => 2, 'search'=>true, 'type' => 'text' ),

            array('title' =>'Action','db'=>'id','dt' => 3 , 'search'=>false, 'type' => 'number',
                'formatter' => function( $d, $row ) {
                    $actionUrl = '/admin/combo';
                    $actionUrlMain = '/admin/index';
                    return '
                        <a class="btn-xs action action-detail btn btn-success btn-default" href="'.$actionUrlMain.'/add/'.$d.'"><i class="icon-edit"></i></a>
                        <a data-id="'.$d.'" id="'.$d.'" data-link="'.$actionUrl.'" class="btn-xs action action-detail btn btn-danger  btn-delete " href="javascript:void(0)"><i class="icon-remove"></i></a>
                    ';

                }
            ),


        );


        /////end column for table
        $table = new AjaxTable($columns, array(), 'admin/combo');
        $table->setTablePrefix('m');
        $table->setExtendSQl(array(
            array('AND','m.isdelete','=','0'),
        ));

        $table->setAjaxCall('/admin/combo');
        $table->setActionDeleteAll('deleteall');
        $this->tableAjaxRequest($table,$columns,$this->modelCombo);
        //end config table


        return new ViewModel(array(
            'table' => $table,
            'title' => $this->translator->translate('Manage Combo')));
    }
    public function ajaxListAction()
    {

        $fields = array(
            'id',
            'menuParentId',
            'menuChildId',
            'menuQuantity',<commit_msg>admin combo<commit_after><?php
/**
 * Created by PhpStorm.
 * User: trisatria
 * Date: 1/6/14
 * Time: 1:17 PM
 */
namespace Admin\Controller;

use Velacolib\Utility\Table;
use Velacolib\Utility\Table\AjaxTable;
use Velacolib\Utility\Table\Detail;

use Admin\Entity\Categories;
use Admin\Entity\Managetable;
use Admin\Model\categoryModel;
use Admin\Model\comboModel;
use Admin\Model\menuModel;
use Velacolib\Utility\Utility;
use Zend\View\Model\ViewModel;
use Zend\Mvc\Controller\AbstractActionController;


class ComboController extends AdminGlobalController
{
    protected   $modelCombo;
    protected   $modelMenu;
    protected  $translator;


    public function init(){
        parent::init();
        $this->modelCombo = new comboModel($this->doctrineService);
        $this->modelMenu = new menuModel($this->doctrineService);

    }


    public function indexAction()
    {

        $columns = array(

            array('title' =>'Id', 'db' => 'id', 'dt' => 0, 'search'=>false, 'type' => 'number' ),
            array('title' =>'Name', 'db' => 'name','dt' => 1, 'search'=>true, 'type' => 'text' ),
            array('title' =>'Category', 'db' => 'catId','dt' => 2, 'search'=>false, 'type' => 'number',
                'dataSelect' => Utility::getCategoryForSelect()
            ),
            array('title' =>'Cost', 'db' => 'cost','dt' => 3, 'search'=>false, 'type' => 'number',
                'formatter' => function($d, $row){
                    return Utility::formatCost($d);
                }
            ),
            array('title' =>'Take Away Cost', 'db' => 'taCost','dt' => 4, 'search'=>false, 'type' => 'number','formatter' => function($d, $row){
                return Utility::formatCost($d);
            } ),
            array('title' =>'Action','db'=>'id','dt' => 5, 'search'=>false, 'type' => 'number',
                'formatter' => function( $d, $row ) {
                    $actionUrl = '/admin/index';
                    return '
                        <a class="btn-xs action action-detail btn btn-success btn-default" href="'.$actionUrl.'/add/'.$d.'"><i class="icon-edit"></i></a>
                        <a data-id="'.$d.'" id="'.$d.'" data-link="'.$actionUrl.'" class="btn-xs action action-detail btn btn-danger  btn-delete " href="javascript:void(0)"><i class="icon-remove"></i></a>
                    ';

                }
            ),


        );


        /////end column for table
        $table = new AjaxTable($columns, array(), 'admin/combo');
        $table->setTablePrefix('m');
        $table->setExtendSQl(array(
            array('AND','m.isdelete','=','0'),
            array('AND','m.isCombo','=','1'),
        ));

        $table->setAjaxCall('/admin/combo');
        $table->setActionDeleteAll('deleteall');
        $this->tableAjaxRequest($table,$columns,$this->modelMenu);
        //end config table


        return new ViewModel(array(
            'table' => $table,
            'title' => $this->translator->translate('Manage Combo')));
    }
    public function ajaxListAction()
    {

        $fields = array(
            'id',
            'menuParentId',
            'menuChildId',
            'menuQuantity',
{'fraction_non_alphanumeric': 0.18420603786457446, 'fraction_numerical': 0.004946273238956166, 'mean_word_length': 2.3375071143995445, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 102, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '526115', 'n_tokens_mistral': 1824, 'n_tokens_neox': 1746, 'n_words': 339}