$params["tName"] = $strTableName;
$params["action"] = postvalue("a");
$params["needSearchClauseObj"] = false;
$params["baseTableName"] = postvalue("table");
$params["afterAdd_id"] = postvalue("afteradd");
$params["masterTable"] = postvalue("mastertable");
if ($pageMode == ADD_INLINE) {
    // Inline add in a 'List page with search' lookup
    $params["forListPageWithSearch"] = postvalue('forLookup');
    $params["screenWidth"] = postvalue("screenWidth");
    $params["screenHeight"] = postvalue("screenHeight");
    $params["orientation"] = postvalue("orientation");
    $params["masterPageType"] = postvalue("mainMPageType");
}
if ($pageMode == ADD_ONTHEFLY || $pageMode == ADD_INLINE && (postvalue('forLookup') || postvalue("category"))) {
    //table where lookup is set
    $params["mainTable"] = postvalue("table");
    //field with lookup is set
    $params["mainField"] = postvalue("field");
    //the ptype od the page where lookup is set
    $params["mainPageType"] = postvalue("pageType");
    //the parent control value
    $params["category"] = postvalue("category");
}
if ($pageMode == ADD_DASHBOARD) {
    $params["dashElementName"] = postvalue("dashelement");
    $params["dashTName"] = postvalue("table");
}
$pageObject = new AddPage($params);
$pageObject->init();
$pageObject->process();
Exemplo n.º 2
0
 /**
  * @param String table
  */
 public static function processAddPageSecurity($table)
 {
     //	user has necessary permissions
     if (Security::checkPagePermissions($table, "A")) {
         return true;
     }
     // display entered data. Give the user chance to relogin. Do nothing for now.
     if (postvalue("a") == "added") {
         return true;
     }
     //	page can not be displayed. Redirect or return error
     //	return error if the page is requested by AJAX
     $pageMode = AddPage::readAddModeFromRequest();
     if ($pageMode != ADD_SIMPLE) {
         Security::sendPermissionError();
         return false;
     }
     // The user is logged in but lacks necessary permissions
     // redirect to List page or Menu.
     if (isLogged() && !isLoggedAsGuest()) {
         Security::redirectToList($table);
         return false;
     }
     redirectToLogin();
     return false;
 }
////////////////////// data picker
////////////////////// time picker
$params['tName'] = $strTableName;
$params['strOriginalTableName'] = $strOriginalTableName;
$params['xt'] =& $xt;
$params['needSearchClauseObj'] = false;
$params['includes_js'] = $includes_js;
$params['includes_jsreq'] = $includes_jsreq;
$params['includes_css'] = $includes_css;
$params['locale_info'] = $locale_info;
$params['pageAddLikeInline'] = $inlineadd == ADD_INLINE;
$params['useTabsOnAdd'] = useTabsOnAdd($strTableName);
if ($params['useTabsOnAdd']) {
    $params['arrAddTabs'] = GetAddTabs($strTableName);
}
$pageObject = new AddPage($params);
//Get detail table keys
$detailKeys = $pageObject->detailKeysByM;
//Array of fields, which appear on add page
$addFields = $pageObject->getFieldsByPageType();
// add button events if exist
if ($inlineadd == ADD_SIMPLE) {
    $pageObject->addButtonHandlers();
}
$url_page = substr($_SERVER["SCRIPT_NAME"], strrpos($_SERVER["SCRIPT_NAME"], "/") + 1, 12);
//For show detail tables on master page add
if ($inlineadd == ADD_SIMPLE || $inlineadd == ADD_MASTER || $inlineadd == ADD_POPUP) {
    $dpParams = array();
    if ($pageObject->isShowDetailTables && !isMobile()) {
        $ids = $id;
        $pageObject->jsSettings['tableSettings'][$strTableName]['dpParams'] = array('tableNames' => $dpParams['strTableNames'], 'ids' => $dpParams['ids']);
$params = array("pageType" => PAGE_ADD,"id" => $id,"mode" => $inlineadd);

$params['xt'] = &$xt;
$params['tName'] = $strTableName;
$params['locale_info'] = $locale_info;
$params['baseTableName'] = postvalue("table");
$params['useTabsOnAdd'] = $gSettings->useTabsOnAdd();
$params['templatefile'] = $templatefile;
$params['pageAddLikeInline'] = ($inlineadd==ADD_INLINE);
$params['needSearchClauseObj'] = false;
$params['strOriginalTableName'] = $strOriginalTableName;

if($params['useTabsOnAdd'])
	$params['arrAddTabs'] = $gSettings->getAddTabs();
	
$pageObject = new AddPage($params);
$pageObject->init();

if(isset($_REQUEST['afteradd'])){
		HeaderRedirect("webreport_users", "add");
	if($eventObj->exists("AfterAdd") && isset($_SESSION['after_add_data'][$_REQUEST['afteradd']])){
	
		$data = $_SESSION['after_add_data'][$_REQUEST['afteradd']];
		$eventObj->AfterAdd($data['avalues'], $data['keys'],$data['inlineadd'], $pageObject);
	
	}
	unset($_SESSION['after_add_data'][$_REQUEST['afteradd']]);
	
	foreach (is_array($_SESSION['after_add_data']) ? $_SESSION['after_add_data'] : array() as $k=>$v){
		if (!is_array($v) or !array_key_exists('time',$v)) {
			unset($_SESSION['after_add_data'][$k]);