Esempio n. 1
0
 public function indexAction()
 {
     $ds = new Am_Query($this->getDi()->apiKeyTable);
     $grid = new Am_Grid_Editable('_api', ___("API Keys"), $ds, $this->_request, $this->view, $this->getDi());
     $grid->addField('comment', ___('Comment'));
     $grid->addField(new Am_Grid_Field_Expandable('key', ___('Key')))->setPlaceholder(array($this, 'truncateKey'));
     $grid->addField(new Am_Grid_Field_IsDisabled());
     $grid->setForm(array($this, 'createForm'));
     $grid->addCallback(Am_Grid_Editable::CB_VALUES_TO_FORM, array($this, 'valuesToForm'));
     $grid->addCallback(Am_Grid_Editable::CB_VALUES_FROM_FORM, array($this, 'valuesFromForm'));
     $grid->addCallback(Am_Grid_ReadOnly::CB_RENDER_CONTENT, array($this, 'renderContent'));
     return $grid->runWithLayout('admin/layout.phtml');
 }
 function viewAction()
 {
     // display payouts list date | method | total | paid |
     $id = $this->getInt('payout_id');
     if (!$id) {
         throw new Am_Exception_InputError("Not payout_id passed");
     }
     $ds = new Am_Query($this->getDi()->affPayoutDetailTable);
     $ds->leftJoin('?_aff_payout', 'p', 'p.payout_id=t.payout_id');
     $ds->leftJoin('?_user', 'u', 't.aff_id=u.user_id');
     $ds->addField('u.*');
     $ds->addField('p.type', 'type');
     $ds->addWhere('t.payout_id=?d', $id);
     $grid = new Am_Grid_Editable('_d', ___("Payout %d Details", $id), $ds, $this->_request, $this->view);
     $grid->setPermissionId('affiliates');
     $grid->addCallback(Am_Grid_Editable::CB_RENDER_TABLE, array($this, 'addBackLink'));
     $grid->addField('email', ___('E-Mail'));
     $grid->addField('name_f', ___('First Name'));
     $grid->addField('name_l', ___('Last Name'));
     $grid->addField('type', ___('Payout Method'));
     $grid->addField('amount', ___('Amount'));
     //        $grid->addField('receipt_id', ___('Receipt Id'));
     $grid->addField('is_paid', ___('Is Paid?'));
     $grid->addField(new Am_Grid_Field_Expandable('_details', ___('Payout Details')))->setGetFunction(array($this, 'getPayoutDetails'));
     $grid->actionsClear();
     //$grid->actionAdd(new Am_Grid_Action_LiveEdit('receipt_id'));
     $grid->actionAdd(new Am_Grid_Action_PayoutMarkPaid('mark_paid', ___("Mark Paid")));
     $grid->actionAdd(new Am_Grid_Action_PayoutMarkNotPaid('mark_notpaid', ___("Mark NOT Paid")));
     $grid->runWithLayout();
     // detail payout records date | method | paid | receipt_id | aff. payout fields
 }
 public function createGrid()
 {
     $ds = new Am_Query($this->getDi()->adminTable);
     $grid = new Am_Grid_Editable('_admin', ___('Admin Accounts'), $ds, $this->_request, $this->view);
     $grid->addField(new Am_Grid_Field('admin_id', '#', true, '', null, '1%'));
     $grid->addField(new Am_Grid_Field('login', ___('Username'), true));
     $grid->addField(new Am_Grid_Field('email', ___('E-Mail'), true));
     $grid->addField(new Am_Grid_Field('super_user', ___('Super Admin'), true))->setRenderFunction('$v->super_user?___("Yes"):___("No")');
     $grid->addField(new Am_Grid_Field('last_login', ___('Last login'), true))->setRenderFunction(array($this, 'renderLoginAt'));
     $grid->setForm(array($this, 'createForm'));
     $grid->addCallback(Am_Grid_Editable::CB_VALUES_TO_FORM, array($this, 'valuesToForm'));
     $grid->addCallback(Am_Grid_Editable::CB_VALUES_FROM_FORM, array($this, 'valuesFromForm'));
     $grid->addCallback(Am_Grid_Editable::CB_BEFORE_SAVE, array($this, 'beforeSave'));
     $grid->addCallback(Am_Grid_Editable::CB_BEFORE_DELETE, array($this, 'beforeDelete'));
     return $grid;
 }
Esempio n. 4
0
 public function setGrid(Am_Grid_Editable $grid)
 {
     $grid->addCallback(Am_Grid_ReadOnly::CB_RENDER_TABLE, array($this, 'renderOut'));
     /* @var $ds Am_Query */
     $this->ds = clone $grid->getDataSource();
     parent::setGrid($grid);
 }
 function createGrid($id, $title)
 {
     $ds = new Am_Query($this->getDi()->banTable);
     $ds->addWhere("`type` = ?", $id);
     $g = new Am_Grid_Editable('_' . $id, ___("Disallow new Signups by %s", $title), $ds, $this->_request, $this->view);
     $g->setForm(array($this, 'createForm'));
     $g->addGridField("value", ___("Locked Value"));
     $g->addGridField("comment", ___("Comment"));
     $g->addCallback(Am_Grid_ReadOnly::CB_RENDER_TABLE, array($this, 'renderConfig'));
     return $g;
 }
Esempio n. 6
0
 function createGrid($id, $title)
 {
     $ds = new Am_Query($this->getDi()->banTable);
     $ds->addWhere("`type` = ?", $id);
     $g = new Am_Grid_Editable('_' . $id, ___('Disallow new Signups by %s', $title), $ds, $this->_request, $this->view);
     $g->setPermissionId(Am_Auth_Admin::PERM_BAN);
     $g->setForm(array($this, 'createForm'));
     $g->addField('value', ___('Locked Value'));
     $g->addField('comment', ___('Comment'));
     $g->addCallback(Am_Grid_ReadOnly::CB_RENDER_TABLE, array($this, 'renderConfig'));
     return $g;
 }
Esempio n. 7
0
 public function createGrid()
 {
     $table = $this->getTable();
     $fields = $table->customFields()->getAll();
     uksort($fields, array($table, 'sortCustomFields'));
     $ds = new Am_Grid_DataSource_CustomField($fields, $table);
     $grid = new Am_Grid_Editable('_f', ___('Additional Fields'), $ds, $this->_request, $this->view);
     $grid->addField(new Am_Grid_Field('name', ___('Name'), true, '', null, '10%'));
     $grid->addField(new Am_Grid_Field('title', ___('Title'), true, '', null, '20%'));
     $grid->addField(new Am_Grid_Field('sql', ___('Field Type'), true, '', null, '10%'))->setRenderFunction(array($this, 'renderFieldType'));
     $grid->addField(new Am_Grid_Field('type', ___('Display Type'), true, '', null, '10%'));
     $grid->addField(new Am_Grid_Field('description', ___('Description'), false, '', null, '40%'));
     $grid->addField(new Am_Grid_Field('validateFunc', ___('Validation'), false, '', null, '20%'))->setGetFunction(create_function('$r', 'return implode(",", (array)$r->validateFunc);'));
     $grid->setForm(array($this, 'createForm'));
     $grid->addCallback(Am_Grid_Editable::CB_VALUES_TO_FORM, array($this, 'valuesToForm'));
     $grid->addCallback(Am_Grid_ReadOnly::CB_TR_ATTRIBS, array($this, 'getTrAttribs'));
     $grid->actionGet('edit')->setIsAvailableCallback(create_function('$record', 'return isset($record->from_config) && $record->from_config;'));
     $grid->actionGet('delete')->setIsAvailableCallback(create_function('$record', 'return isset($record->from_config) && $record->from_config;'));
     $grid->actionAdd(new Am_Grid_Action_Sort_CustomField())->setTable($table);
     $grid->setRecordTitle(___('Field'));
     return $grid;
 }
Esempio n. 8
0
 public function createGrid()
 {
     $ds = new Am_Query($this->getDi()->countryTable);
     $ds->addField('ABS(tag)', 'tag_abs');
     $ds->setOrderRaw('tag_abs desc, title');
     $grid = new Am_Grid_Editable('_c', ___("Browse Countries"), $ds, $this->_request, $this->view);
     $grid->setPermissionId(Am_Auth_Admin::PERM_COUNTRY_STATE);
     $grid->addField(new Am_Grid_Field('tag_abs', ___('Sort Order'), true, null, null, '10%'));
     $grid->addField(new Am_Grid_Field('title', ___('Title'), true));
     $grid->addField(new Am_Grid_Field('country', ___('Code'), true));
     $grid->setForm(array($this, 'createForm'));
     $grid->actionAdd(new Am_Grid_Action_Url_Country('states', ___('Edit States'), '__ROOT__/admin-states/?country=__COUNTRY__'))->setTarget('_top');
     $grid->actionDelete('delete');
     $grid->actionDelete('insert');
     $grid->addCallback(Am_Grid_ReadOnly::CB_TR_ATTRIBS, array($this, 'getTrAttribs'));
     $grid->addCallback(Am_Grid_Editable::CB_VALUES_TO_FORM, array($this, 'valuesToForm'));
     $grid->addCallback(Am_Grid_Editable::CB_VALUES_FROM_FORM, array($this, 'valuesFromForm'));
     $grid->actionAdd(new Am_Grid_Action_LiveEdit('title'));
     $grid->actionAdd(new Am_Grid_Action_Group_CountryEnable(false));
     $grid->actionAdd(new Am_Grid_Action_Group_CountryEnable(true));
     $grid->setFilter(new Am_Grid_Filter_Text(___('Filter by Counrty Title'), array('title' => 'LIKE')));
     return $grid;
 }
Esempio n. 9
0
 public function createGrid()
 {
     $ds = new Am_Query($this->getDi()->helpdeskCategoryTable);
     $ds->leftJoin('?_admin', 'a', 't.owner_id=a.admin_id')->addField("CONCAT(a.login, ' (',a.name_f, ' ', a.name_l, ')')", 'owner');
     $ds->setOrder('sort_order');
     $grid = new Am_Grid_Editable('_helpdesk_category', ___("Ticket Categories"), $ds, $this->_request, $this->view);
     $grid->addField(new Am_Grid_Field('title', ___('Title'), true, '', null, '50%'));
     $grid->addField(new Am_Grid_Field('owner_id', ___('Owner'), true, '', array($this, 'renderOwner')));
     $grid->addField(new Am_Grid_Field_IsDisabled());
     $grid->setForm('Am_Form_Admin_HelpdeskCategory');
     $grid->addCallback(Am_Grid_Editable::CB_BEFORE_SAVE, array($this, 'beforeSave'));
     $grid->setPermissionId(Bootstrap_Helpdesk::ADMIN_PERM_CATEGORY);
     $grid->actionAdd(new Am_Grid_Action_Sort_HelpdeskCategory());
     return $grid;
 }
 protected function _createGrid($title)
 {
     $ds = $this->createDS($this->getLanguage());
     $grid = new Am_Grid_Editable('_trans', $title, $ds, $this->_request, $this->view);
     $grid->addField(new Am_Grid_Field('base', ___('Base'), true, '', null, '50%'));
     $grid->addField(new Am_Grid_Field('trans', ___('Translation'), true, '', array($this, 'renderTrans'), '50%'));
     $grid->setFilter(new Am_Grid_Filter_Trans($this->getLanguage()));
     $grid->actionsClear();
     $grid->setRecordTitle(___('Translation'));
     $grid->addCallback(Am_Grid_ReadOnly::CB_RENDER_CONTENT, array($this, 'wrapContent'));
     $grid->addCallback(Am_Grid_ReadOnly::CB_RENDER_TABLE, array($this, 'wrapTable'));
     return $grid;
 }
 public function createGrid()
 {
     $this->view->headScript()->appendFile(REL_ROOT_URL . "/application/default/views/public/js/jquery/jquery.json.js");
     $this->view->headScript()->appendScript($this->getJs());
     $table = $this->getDi()->savedFormTable;
     $ds = new Am_Query($table);
     $ds->addWhere('`type` in (?a)', array_keys($table->getTypeDefs()));
     $ds->addOrderRaw("`type`='signup' DESC");
     $grid = new Am_Grid_Editable('_s', ___("Forms Editor"), $ds, $this->_request, $this->view);
     $grid->setForm(array($this, 'createForm'));
     $grid->setRecordTitle(' ');
     //$grid->addGridField(new Am_Grid_Field('saved_form_id', '#', true, '', null, '5%'));
     $grid->addGridField(SavedForm::D_SIGNUP, ___('Default Signup'), false)->setWidth('5%')->setRenderFunction(array($this, 'renderDefault'));
     $grid->addGridField(SavedForm::D_MEMBER, ___('Default for Members'), false)->setWidth('5%')->setRenderFunction(array($this, 'renderDefault'));
     $existingTypes = $this->getDi()->savedFormTable->getExistingTypes();
     $grid->actionGet('edit')->setTarget('_top');
     $grid->actionDelete('insert');
     foreach ($this->getDi()->savedFormTable->getTypeDefs() as $type => $typeDef) {
         if (!empty($typeDef['isSingle']) && in_array($type, $existingTypes)) {
             continue;
         }
         $grid->actionAdd(new Am_Grid_Action_Insert('insert-' . $type))->addUrlParam('type', $type)->setTitle(___('New %s', $typeDef['title']));
     }
     $grid->addCallback(Am_Grid_Editable::CB_BEFORE_SAVE, array($this, 'beforeSave'));
     $grid->addGridField(new Am_Grid_Field('type', ___('Type')));
     $grid->addGridField(new Am_Grid_Field('title', ___('Title')));
     $grid->addGridField(new Am_Grid_Field('comment', ___('Comment')));
     $grid->addGridField(new Am_Grid_Field('code', ___('Code')));
     $grid->addGridField(new Am_Grid_Field('url', ___('URL')))->setRenderFunction(array($this, 'renderUrl'));
     $grid->actionGet('delete')->setIsAvailableCallback(create_function('$record', 'return $record->canDelete();'));
     return $grid;
 }
 public function createGrid()
 {
     $ds = new Am_Query($this->getDi()->productTable);
     $ds->setOrderRaw("0+IFNULL(sort_order,0),title");
     $grid = new Am_Grid_Editable('_product', ___("Products"), $ds, $this->_request, $this->view);
     $grid->setRecordTitle(___('Product'));
     $grid->actionAdd(new Am_Grid_Action_Group_ProductAssignCategory(false));
     $grid->actionAdd(new Am_Grid_Action_Group_ProductAssignCategory(true));
     $grid->actionAdd(new Am_Grid_Action_Group_Delete());
     $grid->addGridField(new Am_Grid_Field('product_id', '#', true, '', null, '5%'));
     $grid->addGridField(new Am_Grid_Field('title', ___('Title'), true, '', null, '50%'))->setRenderFunction(array($this, 'renderTitle'));
     $grid->addGridField(new Am_Grid_Field('pgroup', ___('Product Categories'), false))->setRenderFunction(array($this, 'renderPGroup'));
     $grid->addGridField(new Am_Grid_Field('terms', ___('Default Billing Terms')))->setRenderFunction(array($this, 'renderTerms'));
     $grid->addGridField(new Am_Grid_Field('sort_order', ___('Sort Order')));
     $grid->actionGet('edit')->setTarget('_top');
     $grid->actionAdd(new Am_Grid_Action_LiveEdit('sort_order'));
     $grid->setFormValueCallback('start_date', array('RECORD', 'getStartDate'), array('RECORD', 'setStartDate'));
     $grid->setFormValueCallback('require_other', array('RECORD', 'unserializeList'), array('RECORD', 'serializeList'));
     $grid->setFormValueCallback('prevent_if_other', array('RECORD', 'unserializeList'), array('RECORD', 'serializeList'));
     $grid->addCallback(Am_Grid_Editable::CB_AFTER_SAVE, array($this, 'afterSave'));
     $grid->addCallback(Am_Grid_Editable::CB_VALUES_TO_FORM, array($this, 'valuesToForm'));
     //            ->setInputSize(3)->setGetFunction(array($this, 'getSortOrder'));
     ///    protected $liveEditFields = array('title', 'sort_order');
     $grid->setForm(array($this, 'createForm'));
     $grid->setFilter(new Am_Grid_Filter_Product());
     $grid->actionAdd(new Am_Grid_Action_Url('categories', ___('Edit Groups'), REL_ROOT_URL . '/admin-product-categories'))->setType(Am_Grid_Action_Abstract::NORECORD)->setTarget('_top');
     // product upgrades are hidden until fully implemented
     //        $grid->addCallback(Am_Grid_Editable::CB_RENDER_STATIC, array($this, 'renderProductStatic'));
     return $grid;
 }
Esempio n. 13
0
 function commTabAction()
 {
     $this->setActiveMenu('users-browse');
     $ds = new Am_Query($this->getDi()->affCommissionTable);
     $ds->leftJoin('?_invoice', 'i', 'i.invoice_id=t.invoice_id');
     $ds->leftJoin('?_user', 'u', 'u.user_id=i.user_id');
     $ds->leftJoin('?_product', 'p', 't.product_id=p.product_id')->addField('u.user_id', 'user_id')->addField('CONCAT(u.login, \' (\',u.name_f, \' \',u.name_l,\') [#\', u.user_id, \']\')', 'user_name')->addField('p.title', 'product_title')->addField('IF(payout_detail_id IS NULL, \'no\', \'yes\')', 'is_paid');
     $ds->setOrder('date', 'desc')->addWhere('t.aff_id=?', $this->getParam('user_id'));
     $grid = new Am_Grid_Editable('_affcomm', ___('Affiliate Commission'), $ds, $this->_request, $this->view);
     $grid->setPermissionId(Bootstrap_Aff::ADMIN_PERM_ID);
     $grid->actionsClear();
     $userUrl = new Am_View_Helper_UserUrl();
     $grid->addField(new Am_Grid_Field_Date('date', ___('Date')))->setFormatDate();
     $grid->addField('user_name', ___('User'))->addDecorator(new Am_Grid_Field_Decorator_Link($userUrl->userUrl('{user_id}'), '_top'));
     $grid->addField('product_title', ___('Product'));
     $grid->addField('record_type', ___('Type'))->setRenderFunction(array($this, 'renderType'));
     $fieldAmount = $grid->addField('amount', ___('Commission'))->setRenderFunction(array($this, 'renderCommAmount'));
     $grid->addField('is_paid', ___('Paid'));
     $grid->addField('tier', ___('Tier'))->setRenderFunction(array($this, 'renderTier'));
     $grid->addCallback(Am_Grid_ReadOnly::CB_TR_ATTRIBS, array($this, 'commCbGetTrAttribs'));
     $grid->setFilter(new Am_Grid_Filter_AffCommission());
     $grid->actionAdd(new Am_Grid_Action_Total())->addField($fieldAmount, "IF(record_type='void', -1*%1\$s, %1\$s)");
     $grid->actionAdd(new Am_Grid_Action_Aff_Void());
     $grid->runWithLayout('admin/user-layout.phtml');
 }
Esempio n. 14
0
 public function setGrid(Am_Grid_Editable $grid)
 {
     $grid->addCallback(Am_Grid_ReadOnly::CB_RENDER_TABLE, array($this, 'renderLink'));
     parent::setGrid($grid);
 }
Esempio n. 15
0
 public function createGrid()
 {
     $ds = new Am_Query($this->getDi()->helpdeskFaqTable);
     $ds->setOrder('sort_order');
     $grid = new Am_Grid_Editable('_helpdesk_faq', ___('FAQ'), $ds, $this->_request, $this->view);
     $grid->addField(new Am_Grid_Field('title', ___('Title'), true, '', null, '50%'));
     $grid->addField(new Am_Grid_Field('category', ___('Category')));
     $grid->addField('_link', ___('Link'), false)->setRenderFunction(array($this, 'renderLink'));
     $grid->setForm('Am_Form_Admin_HelpdeskFaq');
     $grid->setFilter(new Am_Grid_Filter_HelpdeskFaq());
     $grid->addCallback(Am_Grid_Editable::CB_VALUES_FROM_FORM, array($this, 'valuesFromForm'));
     $grid->setPermissionId(Bootstrap_Helpdesk::ADMIN_PERM_FAQ);
     $grid->actionAdd(new Am_Grid_Action_Sort_HelpdeskFaq());
     if ($this->getDi()->helpdeskFaqTable->getCategories()) {
         $grid->actionAdd(new Am_Grid_Action_EditFaqCategory('faq-edit-category', ___('Edit Categories')));
     }
     return $grid;
 }
    public function detailAction()
    {
        $id = (int) $this->getParam('id');
        if (!$id) {
            throw new Am_Exception_InputError('Empty id passed to ' . __METHOD__);
        }
        $ds = new Am_Query($this->getDi()->couponTable);
        $ds->leftJoin('?_user', 'u', 't.user_id=u.user_id');
        $ds->addField('u.login', 'u_login');
        $ds->addWhere('batch_id=?d', $id);
        $grid = new Am_Grid_Editable('_detail', ___('Coupons'), $ds, $this->_request, $this->view);
        $grid->setPermissionId('grid_coupon');
        $grid->setEventId('gridCoupon');
        $grid->actionsClear();
        $grid->addField('code', ___('Code'), true, null);
        $grid->addField(new Am_Grid_Field_Expandable('used_count', ___('Used For'), false))->setGetFunction(array($this, 'getUsedCount'))->setPlaceholder(array($this, 'getPlaceholder'))->setEscape(false);
        $grid->addField('user_id', ___('User'))->setGetFunction(array($this, 'getUser'));
        $grid->setFilter(new Am_Grid_Filter_Text(___('Filter by Code'), array('code' => 'LIKE')));
        $grid->actionAdd(new Am_Grid_Action_LiveEdit('code'));
        $grid->actionAdd(new Am_Grid_Action_LiveEdit('user_id', ___('Click to Assign')))->setInitCallback('l = function(){this.autocomplete({
    minLength: 2,
    source: window.rootUrl + "/admin-users/autocomplete"
});}')->getDecorator()->setInputTemplate(sprintf('<input type="text" placeholder="%s" />', ___('Type Username or E-Mail')));
        $grid->isAjax(false);
        $grid->addCallback(Am_Grid_ReadOnly::CB_RENDER_CONTENT, array($this, 'couponRenderContent'));
        $response = $grid->run();
        $response->sendHeaders();
        $response->sendResponse();
    }
 public function createGrid()
 {
     $ds = new Am_Query_User();
     $ds->addField("concat(name_f, ' ', name_l)", 'name')->addField('(SELECT count(p.invoice_payment_id) FROM ?_invoice_payment p WHERE p.user_id = u.user_id)', 'payments_count')->addField('IFNULL((SELECT sum(p.amount) FROM ?_invoice_payment p WHERE p.user_id = u.user_id),0)-' . 'IFNULL((SELECT sum(r.amount) FROM ?_invoice_refund r WHERE u.user_id=r.user_id),0)', 'payments_sum');
     $ds->setOrder("login");
     $grid = new Am_Grid_Editable('_u', ___("Browse Users"), $ds, $this->_request, $this->view);
     $grid->setRecordTitle(___('User'));
     $grid->addField(new Am_Grid_Field('login', ___('Username'), true))->setRenderFunction(array($this, 'renderLogin'));
     $grid->addField(new Am_Grid_Field('name', ___('Name'), true));
     $grid->addField(new Am_Grid_Field('email', ___('E-Mail Address'), true));
     $grid->addField(new Am_Grid_Field('payments_sum', ___('Payments'), true, null, array($this, 'renderPayments')));
     $grid->addField('status', ___('Status'), true)->setRenderFunction(array($this, 'renderStatus'));
     $grid->actionAdd($this->createActionExport());
     $grid->actionGet('edit')->setTarget('_top')->showFormAfterSave(true);
     $grid->actionGet('insert')->setTarget('_top')->showFormAfterSave(true);
     $grid->setForm(array($this, 'createForm'));
     $grid->addCallback(Am_Grid_Editable::CB_BEFORE_SAVE, array($this, 'beforeSave'));
     $grid->addCallback(Am_Grid_Editable::CB_AFTER_SAVE, array($this, 'afterSave'));
     $grid->addCallback(Am_Grid_Editable::CB_VALUES_TO_FORM, array($this, 'valuesToForm'));
     $grid->addCallback(Am_Grid_Editable::CB_VALUES_FROM_FORM, array($this, 'valuesFromForm'));
     $grid->addCallback(Am_Grid_Editable::CB_RENDER_STATIC, array($this, 'renderStatic'));
     $grid->addCallback(Am_Grid_ReadOnly::CB_TR_ATTRIBS, array($this, 'getTrAttribs'));
     $grid->actionAdd(new Am_Grid_Action_Group_Callback('lock', ___("Lock"), array($this, 'lockUser')));
     $grid->actionAdd(new Am_Grid_Action_Group_Callback('unlock', ___("Unlock"), array($this, 'unlockUser')));
     $grid->actionAdd(new Am_Grid_Action_Group_EmailUsers());
     $grid->actionAdd(new Am_Grid_Action_Group_MassSubscribe());
     $nc_count = $this->getDi()->cacheFunction->call(array($this, 'getNotConfirmedCount'), array(), array(), 60);
     if ($nc_count) {
         $grid->actionAdd(new Am_Grid_Action_Url('not-confirmed', ___("Not Confirmed Users") . "({$nc_count})", REL_ROOT_URL . '/admin-users/not-confirmed'))->setType(Am_Grid_Action_Abstract::NORECORD)->setTarget('_top');
     }
     $grid->setFilter(new Am_Grid_Filter_User());
     //        $grid->addAction(new Am_Grid_Action_Group_Callback('email', ___("E-Mail"), array($this, 'email')));
     return $grid;
 }
 public function createGrid()
 {
     $title_removed = ___('Rule Removed');
     $ds = new Am_Query($this->getDi()->affCommissionTable);
     $ds->leftJoin('?_invoice', 'i', 'i.invoice_id=t.invoice_id');
     $ds->leftJoin('?_user', 'u', 'u.user_id=i.user_id');
     $ds->leftJoin('?_user', 'a', 't.aff_id=a.user_id');
     $ds->leftJoin('?_product', 'p', 't.product_id=p.product_id');
     $ds->addField('CONCAT(a.login, \' (\', a.name_f, \' \', a.name_l,\') [#\', a.user_id, \']\')', 'aff_name')->addField('u.user_id', 'user_id')->addField('CONCAT(u.login, \' (\',u.name_f, \' \',u.name_l,\') [#\', u.user_id, \']\')', 'user_name')->addField('u.email', 'user_email')->addField('p.title', 'product_title')->addField('i.public_id')->addField('IF(payout_detail_id IS NULL, \'no\', \'yes\')', 'is_paid')->leftJoin('?_aff_commission_commission_rule', 'ccr', 't.commission_id = ccr.commission_id')->leftJoin('?_aff_commission_rule', 'cr', 'ccr.rule_id = cr.rule_id')->addField("GROUP_CONCAT(CONCAT(ccr.rule_id, ' - ', IFNULL(cr.comment, '<em>{$title_removed}</em>')) SEPARATOR '<br />')", 'used_rules')->setOrder('commission_id', 'desc');
     $grid = new Am_Grid_Editable('_affcomm', ___('Affiliate Commission'), $ds, $this->_request, $this->view);
     $grid->setPermissionId(Bootstrap_Aff::ADMIN_PERM_ID);
     $grid->actionsClear();
     $userUrl = new Am_View_Helper_UserUrl();
     $grid->addField(new Am_Grid_Field_Date('date', ___('Date')))->setFormatDate();
     $grid->addField('aff_name', ___('Affiliate'))->addDecorator(new Am_Grid_Field_Decorator_Link($userUrl->userUrl('{aff_id}'), '_top'));
     $grid->addField('user_name', ___('User'))->addDecorator(new Am_Grid_Field_Decorator_Link($userUrl->userUrl('{user_id}'), '_top'));
     $grid->addField('product_title', ___('Product'));
     $grid->addField('record_type', ___('Type'))->setRenderFunction(array($this, 'renderType'));
     $grid->addField('invoice_id', ___('Invoice'))->setGetFunction(array($this, '_getInvoiceNum'))->addDecorator(new Am_Grid_Field_Decorator_Link('admin-user-payments/index/user_id/{user_id}#invoice-{invoice_id}', '_top'));
     $fieldAmount = $grid->addField('amount', ___('Commission'))->setRenderFunction(array($this, 'renderAmount'));
     $grid->addField('is_paid', ___('Paid'));
     $grid->addField('tier', ___('Tier'))->setRenderFunction(array($this, 'renderTier'));
     $grid->addField(new Am_Grid_Field_Expandable('used_rules', '', false))->setPlaceholder(___('Used Rules'));
     $grid->setFilter(new Am_Grid_Filter_Commission());
     $grid->actionAdd(new Am_Grid_Action_Total())->addField($fieldAmount, "IF(record_type='void', -1*%1\$s, %1\$s)");
     $grid->actionAdd(new Am_Grid_Action_Aff_Void());
     $grid->addCallback(Am_Grid_ReadOnly::CB_TR_ATTRIBS, array($this, 'cbGetTrAttribs'));
     return $grid;
 }
 public function createGrid()
 {
     $hasCustomRules = $this->getDi()->affCommissionRuleTable->hasCustomRules();
     $hasTiers = $this->getDi()->affCommissionRuleTable->getMaxTier();
     $ds = new Am_Query($this->getDi()->affCommissionTable);
     $ds->leftJoin('?_invoice', 'i', 'i.invoice_id=t.invoice_id');
     $ds->leftJoin('?_user', 'u', 'u.user_id=i.user_id');
     $ds->leftJoin('?_user', 'a', 't.aff_id=a.user_id');
     $ds->leftJoin('?_product', 'p', 't.product_id=p.product_id');
     $ds->leftJoin('?_aff_payout_detail', 'apd', 't.payout_detail_id=apd.payout_detail_id');
     $ds->leftJoin('?_aff_payout', 'ap', 'ap.payout_id=apd.payout_id');
     $ds->addField('ap.date', 'payout_date');
     $ds->addField('ap.payout_id');
     $ds->addField('CONCAT(a.login, \' (\', a.name_f, \' \', a.name_l,\') #\', a.user_id)', 'aff_name')->addField('u.user_id', 'user_id')->addField('CONCAT(u.login, \' (\',u.name_f, \' \',u.name_l,\') #\', u.user_id)', 'user_name')->addField('u.email', 'user_email')->addField('p.title', 'product_title')->addField('i.public_id')->setOrder('commission_id', 'desc');
     $grid = new Am_Grid_Editable('_affcomm', ___('Affiliate Commission'), $ds, $this->_request, $this->view);
     $grid->setPermissionId(Bootstrap_Aff::ADMIN_PERM_ID);
     $grid->actionsClear();
     $userUrl = new Am_View_Helper_UserUrl();
     $grid->addField(new Am_Grid_Field_Date('date', ___('Date')))->setFormatDate();
     $grid->addField('aff_name', ___('Affiliate'))->addDecorator(new Am_Grid_Field_Decorator_Link($userUrl->userUrl('{aff_id}'), '_top'));
     $grid->addField('user_name', ___('User'))->addDecorator(new Am_Grid_Field_Decorator_Link($userUrl->userUrl('{user_id}'), '_top'));
     $grid->addField('product_title', ___('Product'));
     $grid->addField('invoice_id', ___('Invoice'))->setGetFunction(array($this, '_getInvoiceNum'))->addDecorator(new Am_Grid_Field_Decorator_Link('admin-user-payments/index/user_id/{user_id}#invoice-{invoice_id}', '_top'));
     $fieldAmount = $grid->addField('amount', ___('Amount'))->setRenderFunction(array($this, 'renderAmount'));
     $grid->addField('payout_date', ___('Payout'))->setRenderFunction(array($this, 'renderPayout'));
     if ($hasTiers) {
         $grid->addField('tier', ___('Tier'))->setRenderFunction(array($this, 'renderTier'));
     }
     if ($hasCustomRules) {
         $grid->addField(new Am_Grid_Field_Expandable('commission_id', '', false))->setPlaceholder(___('Used Rules'))->setAjax(REL_ROOT_URL . '/aff/admin-commission/get-rules?id={commission_id}');
     }
     $grid->setFilter(new Am_Grid_Filter_Commission());
     $grid->actionAdd(new Am_Grid_Action_Total())->addField($fieldAmount, "IF(record_type='void', -1*t.%1\$s, t.%1\$s)");
     $grid->actionAdd(new Am_Grid_Action_Aff_Void());
     $grid->addCallback(Am_Grid_ReadOnly::CB_TR_ATTRIBS, array($this, 'cbGetTrAttribs'));
     return $grid;
 }
Esempio n. 20
0
 public function createGrid()
 {
     $ds = new Am_Query($this->getDi()->notificationTable);
     $ds->leftJoin('?_notification_click', 'nc', 't.notification_id=nc.notification_id')->addField('COUNT(nc.notification_click_id)', 'cnt')->addOrder('sort_order');
     $grid = new Am_Grid_Editable('_notification', ___('Notifications'), $ds, $this->_request, $this->view, $this->getDi());
     $grid->setPermissionId(Am_Plugin_Notification::ADMIN_PERM_ID);
     $grid->addField('content', ___('Content'));
     $grid->addField('url', ___('Link'));
     $grid->addField(new Am_Grid_Field_Date('begin', ___('Begin')))->setFormatDate();
     $grid->addField(new Am_Grid_Field_Date('expire', ___('Expire')))->setFormatDate();
     $grid->addField('cnt', ___('Clicks'), true, null, null, '1%')->setRenderFunction(array($this, 'renderClicks'));
     $grid->addField(new Am_Grid_Field_IsDisabled());
     $grid->setForm(array($this, 'createForm'));
     $grid->addCallback(Am_Grid_Editable::CB_VALUES_TO_FORM, array($this, 'valuesToForm'));
     $grid->addCallback(Am_Grid_Editable::CB_VALUES_FROM_FORM, array($this, 'valuesFromForm'));
     $grid->actionAdd(new Am_Grid_Action_NotificationPreview('preview', ___('Preview')))->setTarget('_top');
     $grid->actionAdd(new Am_Grid_Action_Group_Delete());
     $grid->actionAdd(new Am_Grid_Action_Sort_Notification());
     $grid->addCallback(Am_Grid_ReadOnly::CB_RENDER_STATIC, array($this, 'renderStatic'));
     $grid->setFilter(new Am_Grid_Filter_Text(___('Filter by Content or Link'), array('content' => 'LIKE', 'url' => 'LIKE')));
     $grid->setRecordTitle(___('Notification'));
     return $grid;
 }
 public function createGrid()
 {
     $ds = new Am_Query_User();
     $datetime = $this->getDi()->sqlDate;
     $ds->addField("concat(u.name_f, ' ', u.name_l)", 'name')->addField('(SELECT COUNT(p.invoice_payment_id) FROM ?_invoice_payment p WHERE p.user_id = u.user_id)', 'payments_count')->addField('ROUND(IFNULL((SELECT SUM(p.amount/p.base_currency_multi) FROM ?_invoice_payment p WHERE p.user_id = u.user_id),0)-' . 'IFNULL((SELECT SUM(r.amount/r.base_currency_multi) FROM ?_invoice_refund r WHERE u.user_id=r.user_id),0), 2)', 'payments_sum')->addField("(SELECT MAX(expire_date) FROM ?_access ac WHERE ac.user_id = u.user_id)", 'expire')->addField("(SELECT GROUP_CONCAT(title SEPARATOR ', ') FROM ?_access ac\n              LEFT JOIN ?_product p USING (product_id)\n              WHERE ac.user_id = u.user_id AND ac.begin_date<='{$datetime}' AND ac.expire_date>='{$datetime}')", 'products');
     $ds->setOrder("login");
     $grid = new Am_Grid_Editable('_u', ___("Browse Users"), $ds, $this->_request, $this->view);
     $grid->setRecordTitle(array($this, 'getRecordTitle'));
     $grid->addField(new Am_Grid_Field('login', ___('Username'), true))->setRenderFunction(array($this, 'renderLogin'));
     $grid->addField(new Am_Grid_Field('name', ___('Name'), true));
     $grid->addField(new Am_Grid_Field('email', ___('E-Mail Address'), true))->setRenderFunction(array($this, 'renderEmail'));
     $grid->addField(new Am_Grid_Field('payments_sum', ___('Payments'), true, null, array($this, 'renderPayments')));
     $grid->addField('status', ___('Status'), true)->setRenderFunction(array($this, 'renderStatus'));
     $grid->actionAdd($this->createActionExport());
     $grid->actionGet('edit')->setTarget('_top')->showFormAfterSave(true);
     $grid->actionGet('insert')->setTarget('_top')->showFormAfterSave(true);
     $grid->setForm(array($this, 'createForm'));
     $grid->addCallback(Am_Grid_Editable::CB_BEFORE_SAVE, array($this, 'beforeSave'));
     $grid->addCallback(Am_Grid_Editable::CB_AFTER_SAVE, array($this, 'afterSave'));
     $grid->addCallback(Am_Grid_Editable::CB_VALUES_TO_FORM, array($this, 'valuesToForm'));
     $grid->addCallback(Am_Grid_Editable::CB_RENDER_STATIC, array($this, 'renderStatic'));
     $grid->addCallback(Am_Grid_ReadOnly::CB_TR_ATTRIBS, array($this, 'getTrAttribs'));
     $grid->actionAdd($this->createActionCustomize());
     $grid->actionAdd(new Am_Grid_Action_Group_Callback('lock', ___("Lock"), array($this, 'lockUser')));
     $grid->actionAdd(new Am_Grid_Action_Group_Callback('unlock', ___("Unlock"), array($this, 'unlockUser')));
     $grid->actionAdd(new Am_Grid_Action_Group_Callback('approve', ___("Approve"), array($this, 'approveUser')));
     $grid->actionAdd(new Am_Grid_Action_Group_EmailUsers());
     $grid->actionAdd(new Am_Grid_Action_Group_MassSubscribe());
     $grid->actionAdd(new Am_Grid_Action_Group_PasswordConfirmedDelete());
     $grid->actionDelete('delete');
     $grid->actionAdd(new Am_Grid_Action_LoginAs('login', ___('Login as User'), '__ROOT__/admin-users/login-as?id=__ID__'))->setTarget('_blank');
     $grid->actionAdd(new Am_Grid_Action_Delete());
     $grid->actionAdd(new Am_Grid_Action_Merge());
     $grid->actionAdd(new Am_Grid_Action_Group_UserAssignGroup(false));
     $grid->actionAdd(new Am_Grid_Action_Group_UserAssignGroup(true));
     $nc_count = $this->getDi()->cacheFunction->call(array($this, 'getNotConfirmedCount'), array(), array(), 60);
     if ($nc_count) {
         $grid->actionAdd(new Am_Grid_Action_Url('not-confirmed', ___("Not Confirmed Users") . " ({$nc_count})", REL_ROOT_URL . '/admin-users/not-confirmed'))->setType(Am_Grid_Action_Abstract::NORECORD)->setTarget('_top');
     }
     $grid->setFilter(new Am_Grid_Filter_User());
     //        $grid->addAction(new Am_Grid_Action_Group_Callback('email', ___("E-Mail"), array($this, 'email')));
     $grid->setEventId('gridUser');
     return $grid;
 }
Esempio n. 22
0
 public function createGrid()
 {
     $ds = new Am_Query($this->getDi()->otoTable);
     $grid = new Am_Grid_Editable('_oto', ___('One Time Offer'), $ds, $this->_request, $this->view, $this->getDi());
     $grid->setPermissionId(Am_Plugin_Oto::ADMIN_PERM_ID);
     $grid->addField('comment', ___('Comment'));
     $grid->addField(new Am_Grid_Field_IsDisabled());
     $grid->setForm(array($this, 'createForm'));
     $grid->setFormValueCallback('conditions', array('RECORD', 'getConditions'), array('RECORD', 'setConditions'));
     $grid->setFormValueCallback('view', array('RECORD', 'getView'), array('RECORD', 'setView'));
     $grid->actionGet('edit')->setTarget('_top');
     $grid->addCallback(Am_Grid_Editable::CB_VALUES_TO_FORM, array($this, 'valuesToForm'));
     $grid->addCallback(Am_Grid_Editable::CB_VALUES_FROM_FORM, array($this, 'valuesFromForm'));
     $grid->actionAdd(new Am_Grid_Action_Url('preview', ___('Preview'), REL_ROOT_URL . '/admin-one-time-offer/preview?id=__ID__'))->setTarget('_blank');
     $grid->actionAdd(new Am_Grid_Action_CopyOto())->setTarget('_top');
     $grid->actionAdd(new Am_Grid_Action_Group_Callback('disable', ___('Disable'), array($this, 'disableOto')));
     $grid->actionAdd(new Am_Grid_Action_Group_Callback('enable', ___('Enable'), array($this, 'enableOto')));
     $grid->actionAdd(new Am_Grid_Action_Group_Delete());
     $grid->actionAdd(new Am_Grid_Action_LiveEdit('comment'));
     $grid->setRecordTitle(___('One Time Offer'));
     return $grid;
 }
Esempio n. 23
0
 function createGrid()
 {
     $ds = new Am_Query($this->getDi()->savedReportTable);
     $ds->addWhere('admin_id=?', $this->getDi()->authAdmin->getUserId());
     $grid = new Am_Grid_Editable('_report', ___('Saved Reports'), $ds, $this->_request, $this->view);
     $grid->setPermissionId(Am_Auth_Admin::PERM_REPORT);
     $grid->addField(new Am_Grid_Field('title', ___('Title'), true));
     $grid->actionsClear();
     $grid->actionAdd(new Am_Grid_Action_LiveEdit('title'));
     $grid->actionAdd(new Am_Grid_Action_Url('run-report', ___('Run Report'), '__ROOT__/default/admin-reports/p/saved/runsaved/report_id/__ID__'))->setTarget('_top');
     $grid->actionAdd(new Am_Grid_Action_Delete());
     $grid->addCallback(Am_Grid_ReadOnly::CB_RENDER_TABLE, array($this, 'onRenderGridContent'));
     return $grid;
 }
Esempio n. 24
0
 public function createGrid()
 {
     $ds = new Am_Query($this->getDi()->productTable);
     $ds->addWhere('t.is_archived = ?', 0);
     $ds->addOrder('sort_order')->addOrder('title');
     $grid = new Am_Grid_Editable('_product', ___("Products"), $ds, $this->_request, $this->view);
     $grid->setRecordTitle(___('Product'));
     $grid->actionAdd(new Am_Grid_Action_Group_ProductEnable(false));
     $grid->actionAdd(new Am_Grid_Action_Group_ProductEnable(true));
     $grid->actionAdd(new Am_Grid_Action_Group_ProductAssignCategory(false));
     $grid->actionAdd(new Am_Grid_Action_Group_ProductAssignCategory(true));
     $grid->actionAdd(new Am_Grid_Action_Group_ChangeOrder())->setTitle(___('Change Order'));
     $grid->actionAdd(new Am_Grid_Action_Group_Archive(true));
     $grid->addField(new Am_Grid_Field('product_id', '#', true, '', null, '1%'));
     $grid->addField(new Am_Grid_Field('title', ___('Title'), true, '', null, '50%'))->setGetFunction(function ($r, $g, $f) {
         return strip_tags($r->{$f});
     });
     if ($this->getDi()->db->selectCell("SELECT COUNT(*) FROM ?_product_product_category")) {
         $grid->addField(new Am_Grid_Field('pgroup', ___('Product Categories'), false))->setRenderFunction(array($this, 'renderPGroup'));
     }
     $grid->addField(new Am_Grid_Field('terms', ___('Billing Terms'), false))->setRenderFunction(array($this, 'renderTerms'));
     if ($this->getDi()->plugins_tax->getEnabled()) {
         $grid->addField(new Am_Grid_Field('tax_group', ___('Tax')));
         $grid->actionAdd(new Am_Grid_Action_LiveCheckbox('tax_group'))->setValue(IProduct::ALL_TAX)->setEmptyValue(IProduct::NO_TAX);
     }
     $grid->actionGet('edit')->setTarget('_top');
     $grid->actionDelete('delete');
     $grid->actionAdd(new Am_Grid_Action_Archive('delete', 1));
     $grid->actionAdd(new Am_Grid_Action_LiveEdit('title'));
     $grid->actionAdd(new Am_Grid_Action_Sort_Product());
     $grid->setFormValueCallback('start_date', array('RECORD', 'getStartDate'), array('RECORD', 'setStartDate'));
     $grid->setFormValueCallback('require_other', array('RECORD', 'unserializeList'), array('RECORD', 'serializeList'));
     $grid->setFormValueCallback('prevent_if_other', array('RECORD', 'unserializeList'), array('RECORD', 'serializeList'));
     $grid->addCallback(Am_Grid_Editable::CB_AFTER_SAVE, array($this, 'afterSave'));
     $grid->addCallback(Am_Grid_Editable::CB_VALUES_TO_FORM, array($this, 'valuesToForm'));
     $grid->addCallback(Am_Grid_ReadOnly::CB_TR_ATTRIBS, array($this, 'getTrAttribs'));
     $grid->setForm(array($this, 'createForm'));
     $grid->setFilter(new Am_Grid_Filter_Product());
     $grid->setEventId('gridProduct');
     $grid->actionAdd(new Am_Grid_Action_Url('categories', ___('Edit Categories'), REL_ROOT_URL . '/admin-product-categories'))->setType(Am_Grid_Action_Abstract::NORECORD)->setTarget('_top')->setCssClass('link')->setPrivilegeId('edit');
     $grid->actionAdd(new Am_Grid_Action_Url('upgrades', ___('Manage Product Upgrade Paths'), REL_ROOT_URL . '/admin-products/upgrades'))->setType(Am_Grid_Action_Abstract::NORECORD)->setTarget('_top')->setCssClass('link')->setPrivilegeId('edit');
     $grid->actionAdd(new Am_Grid_Action_CopyProduct())->setTarget('_top');
     $ar_count = $this->getArchivedCount(1);
     if ($ar_count) {
         $grid->actionAdd(new Am_Grid_Action_Url('archived', ___("Archived products") . " ({$ar_count})", REL_ROOT_URL . '/admin-products/archived'))->setType(Am_Grid_Action_Abstract::NORECORD)->setTarget('_top')->setCssClass('link')->setPrivilegeId('browse');
     }
     return $grid;
 }
 public function createGrid()
 {
     $ds = new Am_Query($this->getDi()->couponBatchTable);
     $ds->addField('COUNT(c.coupon_id) AS coupons_count');
     $ds->leftJoin('?_coupon', 'c', 't.batch_id = c.batch_id');
     $ds->setOrder('batch_id', 'desc');
     $grid = new Am_Grid_Editable('_coupon', ___("Coupons Batches"), $ds, $this->_request, $this->view);
     $grid->addField('batch_id', ___('Batch ID'), true, '', null, '5%');
     $grid->addField(new Am_Grid_Field_Date('begin_date', ___('Begin Date')))->setFormatDate();
     $grid->addField(new Am_Grid_Field_Date('expire_date', ___('Expire Date')))->setFormatDate();
     $grid->addField('id_disabled', ___('Disabled?'), false, '', array($this, 'renderDisabled'), '10%');
     $grid->addField('is_recurring', ___('Recurring'), true, '', null, '5%');
     $grid->addField('discount', ___('Discount'), true, '', array($this, 'renderDiscount'), '5%');
     $grid->addField('product_ids', ___('Products'), false, '', array($this, 'renderProducts'), '25%');
     $grid->addField('comment', ___('Comment'), true, '', null, '15%');
     $grid->addField('coupons_count', ___('Coupons Count'), true, '', null, '5%');
     $grid->setForm(array($this, 'createForm'));
     $grid->actionGet('edit')->setTarget('_top');
     $grid->actionAdd(new Am_Grid_Action_Url("view", ___("View Coupons"), "javascript:amOpenCoupons(__ID__)"))->setAttribute("class", "coupons-link");
     $grid->actionAdd(new Am_Grid_Action_LiveEdit('comment'));
     $grid->setFormValueCallback('product_ids', array('RECORD', 'unserializeIds'), array('RECORD', 'serializeIds'));
     $grid->addCallback(Am_Grid_Editable::CB_BEFORE_SAVE, array($this, 'beforeSave'));
     $grid->addCallback(Am_Grid_Editable::CB_AFTER_INSERT, array($this, 'afterInsert'));
     $grid->setFilter(new Am_Grid_Filter_Coupon());
     return $grid;
 }