public function execute() { $model = new waModel(); $payment_model = new wacabPaymentModel(); $payments = $payment_model->getAll(); $apps_model = new wacabAppsModel(); $apps = $apps_model->getByField('stat', 1, true); $total = $model->query('SELECT SUM(pay) FROM wacab_payment WHERE `apps_id` is not null')->fetchAll(); $plugins_stat = array(); foreach ($apps as $app) { $app_total = $model->query('SELECT SUM(pay) FROM wacab_payment WHERE `apps_id` = ' . $app['id'])->fetch(); $app_count = $model->query('SELECT COUNT(*) FROM wacab_payment WHERE `pay` >= 0 AND `apps_id` = ' . $app['id'])->fetch(); $app_return = $model->query('SELECT COUNT(*) FROM wacab_payment WHERE `pay` < 0 AND `apps_id` = ' . $app['id'])->fetch(); $names = json_decode($app['name'], true); if ($app['parent'] == 'no_parent' || $app['parent'] == '') { $pname = $names[0]; } else { $pname = $names[0] . " (" . $app['parent'] . ")"; } $plugins_stat[] = array('id' => $app['app_id'], 'total' => $app_total[0], 'name' => $pname, 'count' => $app_count[0], 'return' => $app_return[0]); } $this->view->assign('total', $total); $this->view->assign('apps', $plugins_stat); $this->setTemplate(wacabHelper::getAppPath() . '/templates/actions/statistic/stat_page.html'); }
public function execute() { $apps_model = new wacabAppsModel(); $apps = $apps_model->getAll(); $types = $apps_model->getTypes(); $this->view->assign('types', $types); $parents = $apps_model->getParents(); $this->view->assign('parents', $parents); $this->view->assign('apps', $apps); $this->view->assign('edit', 0); $this->setTemplate(wacabHelper::getAppPath() . '/templates/actions/apps/apps_page.html'); }
public function execute() { echo "AppsAddController"; if (wa()->getUser()->getRights('wacab', 'backend') >= 2) { $model = new wacabAppsModel(); $tmp_name = array(); $tmp_name[] = waRequest::post('name'); $new_app = array('app_id' => waRequest::post('app_id'), 'plugin_id' => waRequest::post('plugin_id'), 'regexp' => json_encode($tmp_name)); $model->insert($new_app); } else { $this->setError(_wp('No permission to add the server')); } }
public function execute() { if (wa()->getUser()->getRights('wacab', 'backend') >= 2) { $apps_model = new wacabAppsModel(); $app = waRequest::get('apps'); if ($app['parent'] === 'null') { $app['parent'] = null; } if (isset($app['id']) && $app['id'] > 0) { $old = $apps_model->getById($app['id']); if ($old['app_id'] != $app['app_id'] && $app['type'] == 'app') { $apps_model->exec('UPDATE wacab_apps SET app_id = s:app_id WHERE app_id = s:old_app_id', array('app_id' => $app['app_id'], 'old_app_id' => $old['app_id'])); } $apps_model->updateById($app['id'], $app); } else { unset($app['id']); $app['name'] = json_encode(array($app['name'])); $apps_model->insert($app); } $view = self::getView(); $apps = $apps_model->getAll(); $types = $apps_model->getTypes(); $parents = $apps_model->getParents(); $view->assign('parents', $parents); $view->assign('types', $types); $view->assign('apps', $apps); $view->assign('edit', 0); $view->assign('app', array()); $this->response = array('apps' => $view->fetch(wacabHelper::getAppPath() . '/templates/actions/apps/apps_table.html'), 'form' => $view->fetch(wacabHelper::getAppPath() . '/templates/actions/apps/apps_form.html')); } else { $this->setError(_wp('No permission to add the app')); } }
public function execute() { if (wa()->getUser()->getRights('wacab', 'backend') >= 2) { $apps_model = new wacabAppsModel(); $id = waRequest::post('id', 0, 'int'); $apps_model->deleteById($id); $view = self::getView(); $apps = $apps_model->getAll(); $types = $apps_model->getTypes(); $parents = $apps_model->getParents(); $view->assign('parents', $parents); $view->assign('types', $types); $view->assign('apps', $apps); $view->assign('edit', 0); $view->assign('app', array()); $this->response = array('apps' => $view->fetch(wacabHelper::getAppPath() . '/templates/actions/apps/apps_table.html'), 'form' => $view->fetch(wacabHelper::getAppPath() . '/templates/actions/apps/apps_form.html')); } else { $this->setError(_wp('No permission to delete app')); } }
public static function checkApps($pay) { $apps_model = new wacabAppsModel(); $no_parent_apps = $apps_model->getByField('parent', 'no_parent', true); $spds = array('Начисление за ', 'Royalty fee for '); $tmp = 0; foreach ($no_parent_apps as $akey => $app) { $app_locs = json_decode($app['name']); foreach ($app_locs as $app_loc) { if (strpos($pay['description'], $app_loc)) { foreach ($spds as $spd) { if ($spd . $app_loc == $pay['description']) { return $app['id']; // $pay['apps_id'] = $app['id']; // break 3; } } $plugins = $apps_model->getByField('parent', $app['app_id'], true); foreach ($plugins as $pkey => $plugin) { $plugin_locs = json_decode($plugin['name']); foreach ($plugin_locs as $plugin_name) { if (strpos($pay['description'], $plugin_name)) { if (strlen($app_loc) > $tmp) { $tmp = strlen($app_loc); $apps_id = $plugin['id']; } } } } } } } if ($tmp > 0) { return $apps_id; // $pay['apps_id'] = $apps_id; // unset($apps_id); } return; }