示例#1
0
 /**
  * Trash 
  * 
  * @param  string $type all|hidden 
  * @param  string $orderBy 
  * @param  int    $recTotal 
  * @param  int    $recPerPage 
  * @param  int    $pageID 
  * @access public
  * @return void
  */
 public function trash($type = 'all', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
 {
     /* Save session. */
     $uri = $this->app->getURI(true);
     $this->session->set('productList', $uri);
     $this->session->set('productPlanList', $uri);
     $this->session->set('releaseList', $uri);
     $this->session->set('storyList', $uri);
     $this->session->set('projectList', $uri);
     $this->session->set('taskList', $uri);
     $this->session->set('buildList', $uri);
     $this->session->set('bugList', $uri);
     $this->session->set('caseList', $uri);
     $this->session->set('testtaskList', $uri);
     $this->session->set('docList', $uri);
     /* Get deleted objects. */
     $this->app->loadClass('pager', $static = true);
     $pager = pager::init($recTotal, $recPerPage, $pageID);
     $trashes = $this->action->getTrashes($type, $orderBy, $pager);
     /* Title and position. */
     $this->view->title = $this->lang->action->trash;
     $this->view->position[] = $this->lang->action->trash;
     $this->view->trashes = $trashes;
     $this->view->type = $type;
     $this->view->orderBy = $orderBy;
     $this->view->pager = $pager;
     $this->view->users = $this->loadModel('user')->getPairs('noletter');
     $this->display();
 }
示例#2
0
 public function _get()
 {
     $total = oo::m()->count();
     $page = $this->req('page');
     pager::init($page, $total);
     $list = oo::m()->limit(pager::$start, pager::$num)->orderby('id desc')->getall();
     method_exists($this, 'after_get') && $this->after_get($list);
     $this->assign('pager', pager::get());
     $this->assign('list', $list);
     $this->display("{$this->form['tpl']}_list");
 }
示例#3
0
 public function index()
 {
     $cid = $this->req('cid', 0, 'intval');
     $where = array();
     $cid && ($where = array('cateid' => $cid));
     $total = oo::m('product')->where($where)->count();
     $page = $this->req('page');
     pager::init($page, $total);
     $list = oo::m('product')->limit(pager::$start, pager::$num)->orderby('id desc')->where($where)->getall();
     $this->assign('list', $list);
     //推荐商家
     $seller = oo::m('seller')->limit(5)->getall();
     $this->assign('seller', $seller);
     $this->display('list');
 }
示例#4
0
 public function defaultpwd($recTotal = 0, $recPerPage = 20, $pageID = 1)
 {
     /* Load pager. */
     $this->app->loadClass('pager', $static = true);
     if ($this->app->getViewType() == 'mhtml') {
         $recPerPage = 10;
     }
     $pager = pager::init($recTotal, $recPerPage, $pageID);
     $passwords = $this->kevinlogin->getPasswordList($pager);
     if (!empty($_POST)) {
         $this->kevinlogin->updateDefaultPwd();
         die(js::reload('parent'));
     }
     $this->view->title = $this->lang->kevinlogin->common . $this->lang->colon . $this->lang->kevinlogin->defaultpwd;
     $this->view->position[] = $this->lang->kevinlogin->defaultpwd;
     $this->view->pager = $pager;
     $this->view->passwords = $passwords;
     $this->view->controlType = 'defaultpwd';
     $this->display();
 }
示例#5
0
 /**
  * Browse bugs.
  * 
  * @param  int    $productID 
  * @param  string $browseType 
  * @param  int    $param 
  * @param  string $orderBy 
  * @param  int    $recTotal 
  * @param  int    $recPerPage 
  * @param  int    $pageID 
  * @access public
  * @return void
  */
 public function browse($productID = 0, $branch = '', $browseType = 'unclosed', $param = 0, $orderBy = '', $recTotal = 0, $recPerPage = 20, $pageID = 1)
 {
     /* Set browseType, productID, moduleID and queryID. */
     $browseType = strtolower($browseType);
     $productID = $this->product->saveState($productID, $this->products);
     if ($branch === '') {
         $branch = $this->session->branch;
     }
     $moduleID = $browseType == 'bymodule' ? (int) $param : 0;
     $queryID = $browseType == 'bysearch' ? (int) $param : 0;
     /* Set menu and save session. */
     $this->bug->setMenu($this->products, $productID, $branch);
     $this->session->set('bugList', $this->app->getURI(true));
     /* Process the order by field. */
     if (!$orderBy) {
         $orderBy = $this->cookie->qaBugOrder ? $this->cookie->qaBugOrder : 'id_desc';
     }
     setcookie('qaBugOrder', $orderBy, $this->config->cookieLife, $this->config->webRoot);
     /* Append id for secend sort. */
     $sort = $this->loadModel('common')->appendOrder($orderBy);
     /* Load pager. */
     $this->app->loadClass('pager', $static = true);
     if ($this->app->getViewType() == 'mhtml') {
         $recPerPage = 10;
     }
     $pager = pager::init($recTotal, $recPerPage, $pageID);
     $projects = $this->loadModel('project')->getPairs();
     $projects[0] = '';
     /* Get bugs. */
     $bugs = array();
     if ($browseType == 'all') {
         $bugs = $this->bug->getAllBugs($productID, $branch, $projects, $sort, $pager);
     } elseif ($browseType == "bymodule") {
         $childModuleIds = $this->tree->getAllChildId($moduleID);
         $bugs = $this->bug->getModuleBugs($productID, $branch, $childModuleIds, $projects, $sort, $pager);
     } elseif ($browseType == 'assigntome') {
         $bugs = $this->bug->getByAssigntome($productID, $branch, $projects, $sort, $pager);
     } elseif ($browseType == 'openedbyme') {
         $bugs = $this->bug->getByOpenedbyme($productID, $branch, $projects, $sort, $pager);
     } elseif ($browseType == 'resolvedbyme') {
         $bugs = $this->bug->getByResolvedbyme($productID, $branch, $projects, $sort, $pager);
     } elseif ($browseType == 'assigntonull') {
         $bugs = $this->bug->getByAssigntonull($productID, $branch, $projects, $sort, $pager);
     } elseif ($browseType == 'unconfirmed') {
         $bugs = $this->bug->getUnconfirmed($productID, $branch, $projects, $sort, $pager);
     } elseif ($browseType == 'unresolved') {
         $bugs = $this->bug->getByStatus($productID, $branch, $projects, 'unresolved', $sort, $pager);
     } elseif ($browseType == 'unclosed') {
         $bugs = $this->bug->getByStatus($productID, $branch, $projects, 'unclosed', $sort, $pager);
     } elseif ($browseType == 'toclosed') {
         $bugs = $this->bug->getByStatus($productID, $branch, $projects, 'toclosed', $sort, $pager);
     } elseif ($browseType == 'longlifebugs') {
         $bugs = $this->bug->getByLonglifebugs($productID, $branch, $projects, $sort, $pager);
     } elseif ($browseType == 'postponedbugs') {
         $bugs = $this->bug->getByPostponedbugs($productID, $branch, $projects, $sort, $pager);
     } elseif ($browseType == 'needconfirm') {
         $bugs = $this->bug->getByNeedconfirm($productID, $branch, $projects, $sort, $pager);
     } elseif ($browseType == 'bysearch') {
         $bugs = $this->bug->getBySearch($productID, $queryID, $sort, $pager, $branch);
     }
     /* Process the sql, get the conditon partion, save it to session. */
     $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'bug', $browseType == 'needconfirm' ? false : true);
     /* Process bug for check story changed. */
     $bugs = $this->loadModel('story')->checkNeedConfirm($bugs);
     /* Build the search form. */
     $this->config->bug->search['actionURL'] = $this->createLink('bug', 'browse', "productID={$productID}&branch={$branch}&browseType=bySearch&queryID=myQueryID");
     $this->config->bug->search['queryID'] = $queryID;
     $this->config->bug->search['params']['product']['values'] = array($productID => $this->products[$productID], 'all' => $this->lang->bug->allProduct);
     $this->config->bug->search['params']['plan']['values'] = $this->loadModel('productplan')->getPairs($productID);
     $this->config->bug->search['params']['module']['values'] = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0);
     $this->config->bug->search['params']['project']['values'] = $this->product->getProjectPairs($productID);
     $this->config->bug->search['params']['openedBuild']['values'] = $this->loadModel('build')->getProductBuildPairs($productID, 0, $params = '');
     $this->config->bug->search['params']['resolvedBuild']['values'] = $this->config->bug->search['params']['openedBuild']['values'];
     if ($this->session->currentProductType == 'normal') {
         unset($this->config->bug->search['fields']['branch']);
         unset($this->config->bug->search['params']['branch']);
     } else {
         $this->config->bug->search['fields']['branch'] = $this->lang->product->branch;
         $this->config->bug->search['params']['branch']['values'] = array('' => '') + $this->loadModel('branch')->getPairs($productID, 'noempty');
     }
     $this->loadModel('search')->setSearchParams($this->config->bug->search);
     $users = $this->user->getPairs('noletter');
     /* Process the openedBuild and resolvedBuild fields. */
     $productIdList = array();
     foreach ($bugs as $bug) {
         $productIdList[$bug->id] = $bug->product;
     }
     $builds = $this->loadModel('build')->getProductBuildPairs(array_unique($productIdList), 0, $params = '');
     foreach ($bugs as $key => $bug) {
         $openBuildIdList = explode(',', $bug->openedBuild);
         $openedBuild = '';
         foreach ($openBuildIdList as $buildID) {
             $openedBuild .= isset($builds[$buildID]) ? $builds[$buildID] : $buildID;
             $openedBuild .= ',';
         }
         $bug->openedBuild = rtrim($openedBuild, ',');
         $bug->resolvedBuild = isset($builds[$bug->resolvedBuild]) ? $builds[$bug->resolvedBuild] : $bug->resolvedBuild;
     }
     $memberPairs = $this->user->getPairs('noletter|nodeleted');
     $title = $this->products[$productID] . $this->lang->colon . $this->lang->bug->common;
     $position[] = html::a($this->createLink('bug', 'browse', "productID={$productID}"), $this->products[$productID]);
     $position[] = $this->lang->bug->common;
     $this->view->title = $title;
     $this->view->position = $position;
     $this->view->productID = $productID;
     $this->view->productName = $this->products[$productID];
     $this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID);
     $this->view->moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'bug', $startModuleID = 0, array('treeModel', 'createBugLink'), '', $branch);
     $this->view->browseType = $browseType;
     $this->view->bugs = $bugs;
     $this->view->users = $users;
     $this->view->pager = $pager;
     $this->view->param = $param;
     $this->view->orderBy = $orderBy;
     $this->view->moduleID = $moduleID;
     $this->view->memberPairs = $memberPairs;
     $this->view->branch = $branch;
     $this->view->branches = $this->loadModel('branch')->getPairs($productID);
     $this->display();
 }
示例#6
0
 /**
  * My dynamic.
  * 
  * @param  string $type 
  * @param  string $orderBy 
  * @param  int    $recTotal 
  * @param  int    $recPerPage 
  * @param  int    $pageID 
  * @access public
  * @return void
  */
 public function dynamic($type = 'today', $orderBy = 'date_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
 {
     /* Save session. */
     $uri = $this->app->getURI(true);
     $this->session->set('productList', $uri);
     $this->session->set('productPlanList', $uri);
     $this->session->set('releaseList', $uri);
     $this->session->set('storyList', $uri);
     $this->session->set('projectList', $uri);
     $this->session->set('taskList', $uri);
     $this->session->set('buildList', $uri);
     $this->session->set('bugList', $uri);
     $this->session->set('caseList', $uri);
     $this->session->set('testtaskList', $uri);
     /* Set the pager. */
     $this->app->loadClass('pager', $static = true);
     $pager = pager::init($recTotal, $recPerPage, $pageID);
     /* Append id for secend sort. */
     $sort = $this->loadModel('common')->appendOrder($orderBy);
     /* The header and position. */
     $this->view->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->dynamic;
     $this->view->position[] = $this->lang->my->dynamic;
     /* Assign. */
     $this->view->type = $type;
     $this->view->recTotal = $recTotal;
     $this->view->recPerPage = $recPerPage;
     $this->view->pageID = $pageID;
     $this->view->orderBy = $orderBy;
     $this->view->pager = $pager;
     $this->view->actions = $this->loadModel('action')->getDynamic($this->app->user->account, $type, $sort, $pager);
     $this->display();
 }
示例#7
0
 /**
  * Link cases to a test task.
  * 
  * @param  int    $taskID 
  * @access public
  * @return void
  */
 public function linkCase($taskID, $param = 'all', $recTotal = 0, $recPerPage = 20, $pageID = 1)
 {
     if (!empty($_POST)) {
         $this->testtask->linkCase($taskID);
         $this->locate(inlink('cases', "taskID={$taskID}"));
     }
     /* Save session. */
     $this->session->set('caseList', $this->app->getURI(true));
     /* Get task and product id. */
     $task = $this->testtask->getById($taskID);
     $productID = $this->product->saveState($task->product, $this->products);
     /* Load pager. */
     $this->app->loadClass('pager', $static = true);
     $pager = pager::init($recTotal, $recPerPage, $pageID);
     /* Build the search form. */
     $this->loadModel('testcase');
     $this->config->testcase->search['params']['product']['values'] = array($productID => $this->products[$productID], 'all' => $this->lang->testcase->allProduct);
     $this->config->testcase->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($productID, $viewType = 'case');
     $this->config->testcase->search['actionURL'] = inlink('linkcase', "taskID={$taskID}");
     $this->view->searchForm = $this->fetch('search', 'buildForm', $this->config->testcase->search);
     /* Save session. */
     $this->testtask->setMenu($this->products, $productID);
     $this->view->header['title'] = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->linkCase;
     $this->view->position[] = html::a($this->createLink('testtask', 'browse', "productID={$productID}"), $this->products[$productID]);
     $this->view->position[] = $this->lang->testtask->linkCase;
     /* Get cases. */
     if ($this->session->testcaseQuery == false) {
         $this->session->set('testcaseQuery', ' 1 = 1');
     }
     $query = str_replace("`product` = 'all'", '1', $this->session->testcaseQuery);
     // If search all product, replace product = all to 1=1
     $linkedCases = $this->dao->select('`case`')->from(TABLE_TESTRUN)->where('task')->eq($taskID)->fetchPairs('case');
     if ($param == 'all') {
         $cases = $this->dao->select('*')->from(TABLE_CASE)->where($query)->andWhere('product')->eq($productID)->andWhere('id')->notIN($linkedCases)->andWhere('deleted')->eq(0)->orderBy('id desc')->page($pager)->fetchAll();
     }
     if ($param == 'bystory') {
         $stories = $this->dao->select('stories')->from(TABLE_BUILD)->where('id')->eq($task->build)->fetch('stories');
         $cases = $this->dao->select('*')->from(TABLE_CASE)->where($query)->andWhere('product')->eq($productID)->beginIF($linkedCases)->andWhere('id')->notIN($linkedCases)->fi()->andWhere('story')->in($stories)->andWhere('deleted')->eq(0)->orderBy('id desc')->page($pager)->fetchAll();
     }
     if ($param == 'bybug') {
         $bugs = $this->dao->select('bugs')->from(TABLE_BUILD)->where('id')->eq($task->build)->fetch('bugs');
         $cases = $this->dao->select('*')->from(TABLE_CASE)->where($query)->andWhere('product')->eq($productID)->beginIF($linkedCases)->andWhere('id')->notIN($linkedCases)->fi()->andWhere('fromBug')->in($bugs)->andWhere('deleted')->eq(0)->orderBy('id desc')->page($pager)->fetchAll();
     }
     $this->view->users = $this->loadModel('user')->getPairs('noletter');
     $this->view->cases = $cases;
     $this->view->taskID = $taskID;
     $this->view->pager = $pager;
     $this->display();
 }
示例#8
0
 /**
  * Company dynamic.
  * 
  * @param  string $browseType 
  * @param  string $orderBy 
  * @param  int    $recTotal 
  * @param  int    $recPerPage 
  * @param  int    $pageID 
  * @access public
  * @return void
  */
 public function dynamic($browseType = 'today', $param = '', $orderBy = 'date_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
 {
     $this->company->setMenu();
     $this->app->loadLang('user');
     $this->app->loadLang('project');
     $this->loadModel('action');
     /* Save session. */
     $uri = $this->app->getURI(true);
     $this->session->set('productList', $uri);
     $this->session->set('productPlanList', $uri);
     $this->session->set('releaseList', $uri);
     $this->session->set('storyList', $uri);
     $this->session->set('projectList', $uri);
     $this->session->set('taskList', $uri);
     $this->session->set('buildList', $uri);
     $this->session->set('bugList', $uri);
     $this->session->set('caseList', $uri);
     $this->session->set('testtaskList', $uri);
     /* Set the pager. */
     $this->app->loadClass('pager', $static = true);
     $pager = pager::init($recTotal, $recPerPage, $pageID);
     $this->view->orderBy = $orderBy;
     $this->view->pager = $pager;
     /* Set the user and type. */
     $account = $browseType == 'account' ? $param : 'all';
     $product = $browseType == 'product' ? $param : 'all';
     $project = $browseType == 'project' ? $param : 'all';
     $period = ($browseType == 'account' or $browseType == 'product' or $browseType == 'project') ? 'all' : $browseType;
     $queryID = $browseType == 'bysearch' ? (int) $param : 0;
     /* Get products' list.*/
     $products = $this->loadModel('product')->getPairs('nocode');
     $products = array($this->lang->product->select) + $products;
     $this->view->products = $products;
     /* Get projects' list.*/
     $projects = $this->loadModel('project')->getPairs('nocode');
     $projects = array($this->lang->project->select) + $projects;
     $this->view->projects = $projects;
     /* Get users.*/
     $users = $this->loadModel('user')->getPairs('nodeleted|noclosed');
     $users[''] = $this->lang->user->select;
     $this->view->users = $users;
     /* The header and position. */
     $this->view->title = $this->lang->company->common . $this->lang->colon . $this->lang->company->dynamic;
     $this->view->position[] = $this->lang->company->dynamic;
     /* Get actions. */
     if ($browseType != 'bysearch') {
         $actions = $this->action->getDynamic($account, $period, $orderBy, $pager, $product, $project);
     } else {
         $actions = $this->action->getDynamicBySearch($products, $projects, $queryID, $orderBy, $pager);
     }
     /* Build search form. */
     $projects[0] = '';
     $products[0] = '';
     $users[''] = '';
     ksort($projects);
     ksort($products);
     $projects['all'] = $this->lang->project->allProject;
     $products['all'] = $this->lang->product->allProduct;
     $this->config->company->dynamic->search['actionURL'] = $this->createLink('company', 'dynamic', "browseType=bysearch&param=myQueryID");
     $this->config->company->dynamic->search['queryID'] = $queryID;
     $this->config->company->dynamic->search['params']['project']['values'] = $projects;
     $this->config->company->dynamic->search['params']['product']['values'] = $products;
     $this->config->company->dynamic->search['params']['actor']['values'] = $users;
     $this->loadModel('search')->setSearchParams($this->config->company->dynamic->search);
     /* Assign. */
     $this->view->browseType = $browseType;
     $this->view->account = $account;
     $this->view->product = $product;
     $this->view->project = $project;
     $this->view->queryID = $queryID;
     $this->view->actions = $actions;
     $this->display();
 }
示例#9
0
 /**
  * Print project block.
  * 
  * @access public
  * @return void
  */
 public function printProjectBlock()
 {
     $this->app->loadClass('pager', $static = true);
     $pager = pager::init(0, $this->params->num, 1);
     $this->view->projectStats = $this->loadModel('project')->getProjectStats($status = 'undone', $productID = 0, $itemCounts = 30, $orderBy = 'code', $pager);
     $this->display();
 }
示例#10
0
 /**
  * Product dynamic.
  * 
  * @param  string $type 
  * @param  string $orderBy 
  * @param  int    $recTotal 
  * @param  int    $recPerPage 
  * @param  int    $pageID 
  * @access public
  * @return void
  */
 public function dynamic($productID = 0, $type = 'today', $param = '', $orderBy = 'date_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
 {
     /* Save session. */
     $uri = $this->app->getURI(true);
     $this->session->set('productList', $uri);
     $this->session->set('productPlanList', $uri);
     $this->session->set('releaseList', $uri);
     $this->session->set('storyList', $uri);
     $this->session->set('projectList', $uri);
     $this->session->set('taskList', $uri);
     $this->session->set('buildList', $uri);
     $this->session->set('bugList', $uri);
     $this->session->set('caseList', $uri);
     $this->session->set('testtaskList', $uri);
     $this->product->setMenu($this->products, $productID);
     /* Append id for secend sort. */
     $sort = $this->loadModel('common')->appendOrder($orderBy);
     /* Set the pager. */
     $this->app->loadClass('pager', $static = true);
     $pager = pager::init($recTotal, $recPerPage, $pageID);
     /* Set the user and type. */
     $account = $type == 'account' ? $param : 'all';
     $period = $type == 'account' ? 'all' : $type;
     /* The header and position. */
     $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->product->dynamic;
     $this->view->position[] = html::a($this->createLink($this->moduleName, 'browse'), $this->products[$productID]);
     $this->view->position[] = $this->lang->product->dynamic;
     /* Assign. */
     $this->view->productID = $productID;
     $this->view->type = $type;
     $this->view->users = $this->loadModel('user')->getPairs('nodeleted|noletter');
     $this->view->account = $account;
     $this->view->orderBy = $orderBy;
     $this->view->pager = $pager;
     $this->view->param = $param;
     $this->view->actions = $this->loadModel('action')->getDynamic($account, $period, $sort, $pager, $productID);
     $this->display();
 }
 /**
  * My sqls
  * @param  string $type
  * @param  int    $recTotal
  * @param  int    $recPerPage
  * @param  int    $pageID
  * @access public
  * @return void
  */
 public function sqlreview($type = 'assignedto', $recTotal = 0, $recPerPage = 20, $pageID = 1)
 {
     /* Save session. */
     $this->session->set('sqlList', $this->app->getURI(true));
     /* Load pager. */
     $this->app->loadClass('pager', $static = true);
     $pager = pager::init($recTotal, $recPerPage, $pageID);
     /* Assign. */
     $this->view->header->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->story;
     $this->view->position[] = $this->lang->my->story;
     $this->view->sqls = $this->loadModel('sqlreview')->getUserSqls($this->app->user->account, $type, 'id_desc', $pager);
     $this->view->users = $this->user->getPairs('noletter');
     $this->view->type = $type;
     $this->view->pager = $pager;
     $this->display();
 }
示例#12
0
 public function browse($libID = 'default', $moduleID = 0, $browseType = 'bymodule', $param = 0, $orderBy = 'lastEditedDate_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
 {
     /* Set browseType.*/
     $browseType = strtolower($browseType);
     $queryID = $browseType == 'bysearch' ? (int) $param : 0;
     if ($libID == 'default') {
         $libID = $this->info->getDefaultLibId();
     }
     //		if (!$libID){
     //			$browseType = 'all';
     //		}
     if ($libID === false) {
         //there is no default lib
         $libName = '';
     } else {
         $libName = $this->infolibs[$libID];
     }
     /* Set menu, save session. */
     $this->info->setMenu($this->infolibs, $libID, 'info');
     $this->session->set('infoList', $this->app->getURI(true));
     /* Process the order by field. */
     if (!$orderBy) {
         $orderBy = $this->cookie->infoOrder ? $this->cookie->infoOrder : 'lastEditedDate_desc';
     }
     setcookie('infoOrder', $orderBy, $this->config->cookieLife, $this->config->webRoot);
     /* Load pager. */
     $this->app->loadClass('pager', $static = true);
     $pager = pager::init($recTotal, $recPerPage, $pageID);
     /* Get infos. */
     $modules = 0;
     $infos = array();
     $tmpinfos = array();
     $infos = $this->dao->select('*')->from(TABLE_INFO)->Where('deleted')->eq(0)->andWhere('Stickie')->eq(2)->orderBy($orderBy)->fetchAll();
     if ($browseType == 'all') {
         $tmpinfos = $this->dao->select('*')->from(TABLE_INFO)->Where('deleted')->eq(0)->andWhere('Stickie')->ne(2)->orderBy('Stickie_desc,' . $orderBy)->page($pager)->fetchAll();
     } elseif ($browseType == "bymodule") {
         if ($moduleID) {
             $modules = $this->info->getAllChildId($moduleID);
         }
         $tmpinfos = $this->info->getInfos($libID, $modules, 'Stickie_desc,' . $orderBy, $pager);
     } elseif ($browseType == 'createdbyme') {
         if ($moduleID) {
             $modules = $this->info->getAllChildId($moduleID);
         }
         $infos = $this->dao->findBycreatedBy($this->app->user->account)->from(TABLE_INFO)->beginIF(is_numeric($libID))->andWhere('lib')->eq($libID)->fi()->beginIF($modules)->andWhere('module')->in($modules)->fi()->andWhere('deleted')->eq(0)->orderBy('Stickie_desc,' . $orderBy)->page($pager)->fetchAll();
     } elseif ($browseType == 'postponed') {
         if ($moduleID) {
             $modules = $this->info->getAllChildId($moduleID);
         }
         $infos = $this->dao->findBydeadline('<', date('Y-m-d'))->from(TABLE_INFO)->andWhere("(`deadline` <> '0000-00-00')")->beginIF(is_numeric($libID))->andWhere('lib')->eq($libID)->fi()->beginIF($modules)->andWhere('module')->in($modules)->fi()->andWhere('deleted')->eq(0)->orderBy('Stickie_desc,' . $orderBy)->page($pager)->fetchAll();
     } elseif ($browseType == 'mailtome') {
         if ($moduleID) {
             $modules = $this->info->getAllChildId($moduleID);
         }
         $infos = $this->dao->findBymailto('LIKE', '%%' . $this->app->user->account . '%%')->from(TABLE_INFO)->beginIF(is_numeric($libID))->andWhere('lib')->eq($libID)->fi()->beginIF($modules)->andWhere('module')->in($modules)->fi()->andWhere('deleted')->eq(0)->orderBy('Stickie_desc,' . $orderBy)->page($pager)->fetchAll();
     } elseif ($browseType == "bysearch") {
         if ($queryID) {
             $query = $this->loadModel('search')->getQuery($queryID);
             if ($query) {
                 $this->session->set('infoQuery', $query->sql);
                 $this->session->set('infoForm', $query->form);
             } else {
                 $this->session->set('infoQuery', ' 1 = 1');
             }
         } else {
             if ($this->session->infoQuery == false) {
                 $this->session->set('infoQuery', ' 1 = 1');
             }
         }
         $infoQuery = $this->session->infoQuery;
         $infos = array();
         //置空总置顶
         $tmpinfos = $this->dao->select('*')->from(TABLE_INFO)->where($infoQuery)->andWhere('deleted')->eq(0)->orderBy('Stickie_desc,' . $orderBy)->page($pager)->fetchAll();
     }
     $infos = array_merge($infos, $tmpinfos);
     /* Process the sql, get the conditon partion, save it to session. Thus the report page can use the same condition. */
     $sql = explode('WHERE', $this->dao->get());
     $sql = explode('ORDER', $sql[1]);
     $sql = explode('AND Stickie', $sql[0]);
     //print $sql[0].'<br />';
     $this->session->set('infoReportCondition', $sql[0]);
     /* Get custom fields. */
     $customFields = $this->cookie->infoFields != false ? $this->cookie->infoFields : $this->config->info->list->defaultFields;
     $customed = !($customFields == $this->config->info->list->defaultFields);
     /* If customed, get related name or titles. */
     if ($customed) {
         /* Get related objects id lists. */
         $relatedModuleIdList = array();
         $relatedLibIdList = array();
         foreach ($infos as $info) {
             $relatedModuleIdList[$info->module] = $info->module;
             $relatedLibIdList[$info->lib] = $info->lib;
             /* Get related objects title or names. */
             $relatedModules = $this->dao->select('id, name')->from(TABLE_INFOMODULE)->where('id')->in($relatedModuleIdList)->fetchPairs();
             $relatedLibs = $this->dao->select('id, name')->from(TABLE_INFOLIB)->where('id')->in($relatedLibIdList)->fetchPairs();
             /* fill some field with useful value. */
             if (isset($relatedModules[$info->module])) {
                 $info->module = $relatedModules[$info->module];
             }
             if (isset($relatedLibs[$info->lib])) {
                 $info->lib = $relatedLibs[$info->lib];
             }
         }
     }
     //*********************************************************************************************
     /* Build the search form. */
     $this->config->info->search['actionURL'] = $this->createLink('info', 'browse', "libID={$libID}&moduleID={$moduleID}&browseType=bySearch&queryID=myQueryID");
     $this->config->info->search['queryID'] = $queryID;
     $this->config->info->search['params']['lib']['values'] = array('' => '') + $this->infolibs;
     /* Get the modules. */
     $moduleOptionMenu = $this->info->getOptionMenu($libID, 'info', $startModuleID = 0);
     $this->config->info->search['params']['module']['values'] = array('' => '') + $moduleOptionMenu;
     $this->view->searchForm = $this->fetch('search', 'buildForm', $this->config->info->search);
     //*********************************************************************************************
     $users = $this->user->getPairs('noletter');
     if ($browseType == 'all') {
         $this->view->header->title = $this->lang->info->index;
     } else {
         $this->view->header->title = $libName . $this->lang->colon . $this->lang->info->index;
         $this->view->position[] = html::a($this->createLink('info', 'browse', "libID={$libID}"), $libName);
     }
     $this->view->position[] = $this->lang->info->list;
     $this->view->moduleTree = $this->info->getTreeMenu($libID, $viewType = 'info', $startModuleID = 0, array('infoModel', 'createInfoLink'));
     $this->view->treeClass = $browseType == 'bymodule' ? '' : 'hidden';
     $this->view->browseType = $browseType;
     $this->view->moduleID = $moduleID;
     $this->view->libID = $libID;
     $this->view->infos = $infos;
     $this->view->users = $users;
     $this->view->pager = $pager;
     $this->view->param = $param;
     $this->view->orderBy = $orderBy;
     $this->view->customed = $customed;
     $this->view->type = 'info';
     $this->view->customFields = explode(',', str_replace(' ', '', trim($customFields)));
     $this->display();
 }
 /**
  * Print project block.
  * 
  * @access public
  * @return void
  */
 public function printProjectBlock()
 {
     $this->app->loadClass('pager', $static = true);
     $pager = pager::init(0, $this->params->num, 1);
     $this->view->projectStats = $this->loadModel('project')->getProjectStats($status = 'undone', $productID = 0, $branch = 0, $itemCounts = 30, $orderBy = 'order_desc', $this->viewType != 'json' ? $pager : '');
     $this->view->listLink = $this->view->sso . $this->view->sign . 'referer=' . base64_encode($this->createLink('my', 'project'));
 }
示例#14
0
文件: control.php 项目: XMGmen/zentao
 /**
  * My sprinttasks
  * 
  * @param  string $type 
  * @param  int    $recTotal 
  * @param  int    $recPerPage 
  * @param  int    $pageID 
  * @access public
  * @return void
  */
 public function sprinttask($sprintID = 0, $type = 'assignedTo', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
 {
     /* Save session. */
     $this->session->set('taskList', $this->app->getURI(true));
     $this->session->set('storyList', $this->app->getURI(true));
     /* Load pager. */
     $this->app->loadClass('pager', $static = true);
     if ($this->app->getViewType() == 'mhtml') {
         $recPerPage = 10;
     }
     $pager = pager::init($recTotal, $recPerPage, $pageID);
     /* Append id for secend sort. */
     $sort = $this->loadModel('common')->appendOrder($orderBy);
     /* Assign. */
     $this->view->sprintID = $sprintID;
     $this->view->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->task;
     $this->view->position[] = $this->lang->my->task;
     $this->view->tabID = 'task';
     $this->view->tasks = $this->loadModel('task')->getUserSprintTasks($this->app->user->account, $sprintID, $type, 0, $pager, $sort);
     $this->view->type = $type;
     $this->view->recTotal = $recTotal;
     $this->view->recPerPage = $recPerPage;
     $this->view->pageID = $pageID;
     $this->view->orderBy = $orderBy;
     $this->view->users = $this->loadModel('user')->getPairs('noletter');
     $this->view->pager = $pager;
     $this->display();
 }
示例#15
0
文件: control.php 项目: XMGmen/zentao
 /**
  * Browse cases.
  * 
  * @param  int    $productID 
  * @param  string $browseType 
  * @param  int    $param 
  * @param  string $orderBy 
  * @param  int    $recTotal 
  * @param  int    $recPerPage 
  * @param  int    $pageID 
  * @access public
  * @return void
  */
 public function browse($productID = 0, $browseType = 'all', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
 {
     /* Set browseType, productID, moduleID and queryID. */
     $browseType = strtolower($browseType);
     $productID = $this->product->saveState($productID, $this->products);
     $moduleID = $browseType == 'bymodule' ? (int) $param : 0;
     $queryID = $browseType == 'bysearch' ? (int) $param : 0;
     /* Set menu, save session. */
     $this->testcase->setMenu($this->products, $productID);
     $this->session->set('caseList', $this->app->getURI(true));
     $this->session->set('productID', $productID);
     $this->session->set('moduleID', $moduleID);
     $this->session->set('browseType', $browseType);
     $this->session->set('orderBy', $orderBy);
     /* Load lang. */
     $this->app->loadLang('testtask');
     /* Load pager. */
     $this->app->loadClass('pager', $static = true);
     $pager = pager::init($recTotal, $recPerPage, $pageID);
     $sort = $this->loadModel('common')->appendOrder($orderBy);
     /* By module or all cases. */
     if ($browseType == 'bymodule' or $browseType == 'all') {
         $childModuleIds = $this->tree->getAllChildId($moduleID);
         $this->view->cases = $this->testcase->getModuleCases($productID, $childModuleIds, $sort, $pager);
     } elseif ($browseType == 'needconfirm') {
         $this->view->cases = $this->dao->select('t1.*, t2.title AS storyTitle')->from(TABLE_CASE)->alias('t1')->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id')->where("t2.status = 'active'")->andWhere('t1.deleted')->eq(0)->andWhere('t2.version > t1.storyVersion')->orderBy($sort)->page($pager)->fetchAll();
     } elseif ($browseType == 'bysearch') {
         if ($queryID) {
             $query = $this->loadModel('search')->getQuery($queryID);
             if ($query) {
                 $this->session->set('testcaseQuery', $query->sql);
                 $this->session->set('testcaseForm', $query->form);
             } else {
                 $this->session->set('testcaseQuery', ' 1 = 1');
             }
         } else {
             if ($this->session->testcaseQuery == false) {
                 $this->session->set('testcaseQuery', ' 1 = 1');
             }
         }
         $queryProductID = $productID;
         $allProduct = "`product` = 'all'";
         $caseQuery = '(' . $this->session->testcaseQuery;
         if (strpos($this->session->testcaseQuery, $allProduct) !== false) {
             $products = array_keys($this->loadModel('product')->getPrivProducts());
             $caseQuery = str_replace($allProduct, '1', $caseQuery);
             $caseQuery = $caseQuery . ' AND `product`' . helper::dbIN($products);
             $queryProductID = 'all';
         }
         $caseQuery .= ')';
         $this->view->cases = $this->dao->select('*')->from(TABLE_CASE)->where($caseQuery)->beginIF($queryProductID != 'all')->andWhere('product')->eq($productID)->fi()->andWhere('deleted')->eq(0)->orderBy($sort)->page($pager)->fetchAll();
     }
     /* save session .*/
     $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'testcase', $browseType != 'bysearch' ? false : true);
     /* Build the search form. */
     $this->config->testcase->search['params']['product']['values'] = array($productID => $this->products[$productID], 'all' => $this->lang->testcase->allProduct);
     $this->config->testcase->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($productID, $viewType = 'case');
     $this->config->testcase->search['actionURL'] = $this->createLink('testcase', 'browse', "productID={$productID}&browseType=bySearch&queryID=myQueryID");
     $this->config->testcase->search['queryID'] = $queryID;
     $this->loadModel('search')->setSearchParams($this->config->testcase->search);
     /* Assign. */
     $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testcase->common;
     $this->view->position[] = html::a($this->createLink('testcase', 'browse', "productID={$productID}"), $this->products[$productID]);
     $this->view->position[] = $this->lang->testcase->common;
     $this->view->productID = $productID;
     $this->view->productName = $this->products[$productID];
     $this->view->moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'case', $startModuleID = 0, array('treeModel', 'createCaseLink'));
     $this->view->moduleID = $moduleID;
     $this->view->pager = $pager;
     $this->view->users = $this->user->getPairs('noletter');
     $this->view->orderBy = $orderBy;
     $this->view->browseType = $browseType;
     $this->view->param = $param;
     $this->display();
 }
示例#16
0
 /**
  * User dynamic.
  * 
  * @param  string $period 
  * @param  string $account 
  * @param  string $orderBy 
  * @param  int    $recTotal 
  * @param  int    $recPerPage 
  * @param  int    $pageID 
  * @access public
  * @return void
  */
 public function dynamic($period = 'today', $account = '', $orderBy = 'date_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
 {
     /* set menus. */
     $this->lang->set('menugroup.user', 'company');
     $this->view->userList = $this->user->setUserList($this->user->getPairs('noempty|noclosed|nodeleted'), $account);
     /* Save session. */
     $uri = $this->app->getURI(true);
     $this->session->set('productList', $uri);
     $this->session->set('productPlanList', $uri);
     $this->session->set('releaseList', $uri);
     $this->session->set('storyList', $uri);
     $this->session->set('projectList', $uri);
     $this->session->set('taskList', $uri);
     $this->session->set('buildList', $uri);
     $this->session->set('bugList', $uri);
     $this->session->set('caseList', $uri);
     $this->session->set('testtaskList', $uri);
     /* Set the pager. */
     $this->app->loadClass('pager', $static = true);
     $pager = pager::init($recTotal, $recPerPage, $pageID);
     $this->view->orderBy = $orderBy;
     $this->view->pager = $pager;
     $this->view->title = $this->lang->user->common . $this->lang->colon . $this->lang->user->dynamic;
     $this->view->position[] = $this->lang->user->dynamic;
     /* Assign. */
     $this->view->period = $period;
     $this->view->users = $this->loadModel('user')->getPairs('nodeleted|noletter');
     $this->view->account = $account;
     $this->view->user = $this->dao->findByAccount($account)->from(TABLE_USER)->fetch();
     $this->view->actions = $this->loadModel('action')->getDynamic($account, $period, $orderBy, $pager);
     $this->display();
 }
示例#17
0
 /**
  * Browse bugs.
  * 
  * @param  int    $productID 
  * @param  string $browseType 
  * @param  int    $param 
  * @param  string $orderBy 
  * @param  int    $recTotal 
  * @param  int    $recPerPage 
  * @param  int    $pageID 
  * @access public
  * @return void
  */
 public function browse($productID = 0, $browseType = 'byModule', $param = 0, $orderBy = '', $recTotal = 0, $recPerPage = 20, $pageID = 1)
 {
     /* Set browseType, productID, moduleID and queryID. */
     $browseType = strtolower($browseType);
     $productID = $this->product->saveState($productID, $this->products);
     $moduleID = $browseType == 'bymodule' ? (int) $param : 0;
     $queryID = $browseType == 'bysearch' ? (int) $param : 0;
     /* Set menu and save session. */
     $this->bug->setMenu($this->products, $productID);
     $this->session->set('bugList', $this->app->getURI(true));
     /* Process the order by field. */
     if (!$orderBy) {
         $orderBy = $this->cookie->qaBugOrder ? $this->cookie->qaBugOrder : 'id_desc';
     }
     setcookie('qaBugOrder', $orderBy, $this->config->cookieLife, $this->config->webRoot);
     /* Load pager. */
     $this->app->loadClass('pager', $static = true);
     $pager = pager::init($recTotal, $recPerPage, $pageID);
     $projects = $this->loadModel('project')->getPairs();
     $projects[0] = '';
     /* Get bugs. */
     $bugs = array();
     if ($browseType == 'all') {
         $bugs = $this->bug->getAllBugs($productID, $projects, $orderBy, $pager);
     } elseif ($browseType == "bymodule") {
         $childModuleIds = $this->tree->getAllChildId($moduleID);
         $bugs = $this->bug->getModuleBugs($productID, $childModuleIds, $projects, $orderBy, $pager);
     } elseif ($browseType == 'assigntome') {
         $bugs = $this->bug->getByAssigntome($productID, $projects, $orderBy, $pager);
     } elseif ($browseType == 'openedbyme') {
         $bugs = $this->bug->getByOpenedbyme($productID, $projects, $orderBy, $pager);
     } elseif ($browseType == 'resolvedbyme') {
         $bugs = $this->bug->getByResolvedbyme($productID, $projects, $orderBy, $pager);
     } elseif ($browseType == 'assigntonull') {
         $bugs = $this->bug->getByAssigntonull($productID, $projects, $orderBy, $pager);
     } elseif ($browseType == 'unresolved') {
         $bugs = $this->bug->getByStatus($productID, $projects, 'unresolved', $orderBy, $pager);
     } elseif ($browseType == 'unclosed') {
         $bugs = $this->bug->getByStatus($productID, $projects, 'unclosed', $orderBy, $pager);
     } elseif ($browseType == 'longlifebugs') {
         $bugs = $this->bug->getByLonglifebugs($productID, $projects, $orderBy, $pager);
     } elseif ($browseType == 'postponedbugs') {
         $bugs = $this->bug->getByPostponedbugs($productID, $projects, $orderBy, $pager);
     } elseif ($browseType == 'needconfirm') {
         $bugs = $this->bug->getByNeedconfirm($productID, $projects, $orderBy, $pager);
     } elseif ($browseType == 'bysearch') {
         $bugs = $this->bug->getBySearch($productID, $projects, $queryID, $orderBy, $pager);
     }
     /* Process the sql, get the conditon partion, save it to session. */
     if ($browseType != 'needconfirm') {
         $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'bug');
     }
     /* Get custom fields. */
     $customFields = $this->cookie->bugFields != false ? $this->cookie->bugFields : $this->config->bug->list->defaultFields;
     $customed = !($customFields == $this->config->bug->list->defaultFields);
     /* If customed, get related name or titles. */
     if ($customed) {
         $bugs = $this->bug->formCustomedBugs($bugs);
     }
     /* Build the search form. */
     $this->config->bug->search['actionURL'] = $this->createLink('bug', 'browse', "productID={$productID}&browseType=bySearch&queryID=myQueryID");
     $this->config->bug->search['queryID'] = $queryID;
     $this->config->bug->search['params']['product']['values'] = array($productID => $this->products[$productID], 'all' => $this->lang->bug->allProduct);
     $this->config->bug->search['params']['module']['values'] = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0);
     $this->config->bug->search['params']['project']['values'] = $this->product->getProjectPairs($productID);
     $this->config->bug->search['params']['openedBuild']['values'] = $this->loadModel('build')->getProductBuildPairs($productID);
     $this->config->bug->search['params']['resolvedBuild']['values'] = $this->build->getProductBuildPairs($productID);
     $this->view->searchForm = $this->fetch('search', 'buildForm', $this->config->bug->search);
     $users = $this->user->getPairs('noletter');
     /* Process the openedBuild and resolvedBuild fields. */
     $builds = $this->loadModel('build')->getProductBuildPairs($productID);
     foreach ($bugs as $key => $bug) {
         $openBuildIdList = explode(',', $bug->openedBuild);
         $openedBuild = '';
         foreach ($openBuildIdList as $buildID) {
             $openedBuild .= isset($builds[$buildID]) ? $builds[$buildID] : $buildID;
             $openedBuild .= ',';
         }
         $bug->openedBuild = rtrim($openedBuild, ',');
         $bug->resolvedBuild = isset($builds[$bug->resolvedBuild]) ? $builds[$bug->resolvedBuild] : $bug->resolvedBuild;
     }
     $header['title'] = $this->products[$productID] . $this->lang->colon . $this->lang->bug->common;
     $position[] = html::a($this->createLink('bug', 'browse', "productID={$productID}"), $this->products[$productID]);
     $position[] = $this->lang->bug->common;
     $this->view->header = $header;
     $this->view->position = $position;
     $this->view->productID = $productID;
     $this->view->productName = $this->products[$productID];
     $this->view->moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'bug', $startModuleID = 0, array('treeModel', 'createBugLink'));
     $this->view->browseType = $browseType;
     $this->view->bugs = $bugs;
     $this->view->users = $users;
     $this->view->pager = $pager;
     $this->view->param = $param;
     $this->view->orderBy = $orderBy;
     $this->view->moduleID = $moduleID;
     $this->view->customed = $customed;
     $this->view->customFields = explode(',', str_replace(' ', '', trim($customFields)));
     $this->view->treeClass = $browseType == 'bymodule' ? '' : 'hidden';
     $this->display();
 }
示例#18
0
文件: control.php 项目: XMGmen/zentao
 /**
  * Project dynamic.
  * 
  * @param  string $type 
  * @param  string $orderBy 
  * @param  int    $recTotal 
  * @param  int    $recPerPage 
  * @param  int    $pageID 
  * @access public
  * @return void
  */
 public function dynamic($projectID = 0, $type = 'today', $param = '', $orderBy = 'date_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
 {
     /* Save session. */
     $uri = $this->app->getURI(true);
     $this->session->set('productList', $uri);
     $this->session->set('productPlanList', $uri);
     $this->session->set('releaseList', $uri);
     $this->session->set('storyList', $uri);
     $this->session->set('projectList', $uri);
     $this->session->set('taskList', $uri);
     $this->session->set('buildList', $uri);
     $this->session->set('bugList', $uri);
     $this->session->set('caseList', $uri);
     $this->session->set('testtaskList', $uri);
     /* use first project if projectID does not exist. */
     if (!isset($this->projects[$projectID])) {
         $projectID = key($this->projects);
     }
     /* Append id for secend sort. */
     $sort = $this->loadModel('common')->appendOrder($orderBy);
     /* Set the menu. If the projectID = 0, use the indexMenu instead. */
     $this->project->setMenu($this->projects, $projectID);
     if ($projectID == 0) {
         $this->projects = array('0' => $this->lang->project->selectProject) + $this->projects;
         unset($this->lang->project->menu);
         $this->lang->project->menu = $this->lang->project->indexMenu;
         $this->lang->project->menu->list = $this->project->select($this->projects, 0, 'project', 'dynamic');
     }
     /* Set the pager. */
     $this->app->loadClass('pager', $static = true);
     $pager = pager::init($recTotal, $recPerPage, $pageID);
     /* Set the user and type. */
     $account = $type == 'account' ? $param : 'all';
     $period = $type == 'account' ? 'all' : $type;
     /* The header and position. */
     $project = $this->project->getByID($projectID);
     $this->view->title = $project->name . $this->lang->colon . $this->lang->project->dynamic;
     $this->view->position[] = html::a($this->createLink('project', 'browse', "projectID={$projectID}"), $project->name);
     $this->view->position[] = $this->lang->project->dynamic;
     /* Assign. */
     $this->view->projectID = $projectID;
     $this->view->type = $type;
     $this->view->users = $this->loadModel('user')->getPairs('nodeleted|noletter');
     $this->view->account = $account;
     $this->view->orderBy = $orderBy;
     $this->view->pager = $pager;
     $this->view->param = $param;
     $this->view->actions = $this->loadModel('action')->getDynamic($account, $period, $sort, $pager, 'all', $projectID);
     $this->display();
 }
示例#19
0
文件: db.php 项目: rigidus/ea
 function query($sql)
 {
     self::$query_count++;
     $start_time = explode(" ", microtime());
     self::$res = mysql_query($sql);
     $finish_time = explode(" ", microtime());
     $queryTime = round($finish_time[1] + $finish_time[0] - $start_time[1] - $start_time[0], 4);
     self::queriesTime($queryTime);
     self::$sql_log[self::$sql_index] = array('query' => $sql, 'time' => $queryTime);
     self::$sql_index++;
     if (self::$pager) {
         self::$total_rows = db::foundRows();
         $num_pages = ceil(self::$total_rows / self::$pager_per_page);
         if ($num_pages > 1) {
             for ($i = 1; $i <= $num_pages; $i++) {
                 $pages[$i] = self::$pager_uri . 'page=' . $i;
             }
             pager::init($pages, self::$cur_page, self::$pager_uri);
         }
     }
     return self::$res;
 }