Ejemplo n.º 1
0
	$lAdmin->NavText($adminResult->GetNavPrint(Loc::getMessage('SALE_LOCATION_L_PAGES'), true)); // do not relocate the call relative to DisplayList(), or you`ll catch a strange nav bar disapper bug
}
catch(Main\SystemException $e)
{
	$code = $e->getCode();
	$fatal = $e->getMessage().(!empty($code) ? ' ('.$code.')' : '');
}

#####################################
#### PAGE INTERFACE GENERATION
#####################################

if(empty($fatal))
{
	$headers = array();
	foreach(Helper::getListGridColumns() as $code => $fld)
		$headers[] = array("id" => $code, "content" => $columns[$code]['title'], "default" => $fld['DEFAULT'], "sort" => $code);

	$lAdmin->AddHeaders($headers);
	while($elem = $adminResult->NavNext(true, "f_"))
	{
		foreach($columns as $code => $fld)
		{
			if(isset($elem[$code]))
				Helper::makeSafeDisplay($elem[$code], $code);
		}

		// urls
		$editUrl = Helper::getEditUrl($elem['ID']);
		$copyUrl = Helper::getEditUrl(false, array('copy_id' => $elem['ID']));
		$listUrl = Helper::getListUrl($elem['ID'], array());
Ejemplo n.º 2
0
 /**
  * Function makes some actions based on what is in $this->request
  * @return void
  */
 protected function performAction()
 {
     $this->dbResult['REQUEST'] = array('GET' => $this->request->getQueryList(), 'POST' => $this->request->getPostList());
     $this->componentData['LIST_HEADERS'] = Helper::getListGridColumns();
     // columns figure in list
     $this->componentData['FILTER_HEADERS'] = Helper::getFilterColumns();
     // columns figure in filter
     //_print_r($this->dbResult['REQUEST']);
     $requestMethod = \Bitrix\Main\Context::getCurrent()->getServer()->getRequestMethod();
     $this->getGridOpts();
     $gridId = $this->dbResult['GRID_ID'];
     $parameters = array();
     $actionSupposeToBeDone = false;
     if ($requestMethod === 'POST' && check_bitrix_sessid() && isset($this->dbResult['REQUEST']['POST']['action_button_' . $gridId])) {
         // group delete
         $action = $this->dbResult['REQUEST']['POST']['action_button_' . $gridId];
         if ($this->dbResult['CAN_DELETE'] && $action === 'delete') {
             if ($this->dbResult['REQUEST']['POST']['action_all_rows_' . $gridId] == 'Y') {
                 $parameters = $this->getListParameters();
             } else {
                 // delete all by list
                 $parameters['ID'] = $this->dbResult['REQUEST']['POST']['ID'];
             }
             $actionSupposeToBeDone = true;
         }
     } elseif ($requestMethod == 'GET' && check_bitrix_sessid() && isset($this->dbResult['REQUEST']['GET']['action_' . $gridId])) {
         // single delete
         if ($this->dbResult['CAN_DELETE'] && $this->dbResult['REQUEST']['GET']['action_' . $gridId] === 'delete') {
             if (isset($this->dbResult['REQUEST']['GET']['ID'])) {
                 $parameters['ID'] = array($this->dbResult['REQUEST']['GET']['ID']);
             }
         }
         $actionSupposeToBeDone = true;
     }
     $parameters['OPERATION'] = 'DELETE';
     $result = Helper::performGridOperations($parameters);
     if (is_array($result['errors'])) {
         $this->errors['NONFATAL'] = array_merge($this->errors['NONFATAL'], $result['errors']);
     }
     if ($actionSupposeToBeDone && !$this->checkHasErrors() && !isset($this->dbResult['REQUEST']['POST']['AJAX_CALL'])) {
         LocalRedirect($GLOBALS['APPLICATION']->GetCurPage());
     }
 }