コード例 #1
0
ファイル: Languages.class.php プロジェクト: mozdial/Directory
 function __construct($id = '')
 {
     parent::__construct();
     if ($id != '') {
         $this->__construct_single($id);
     } else {
         $this->__construct_all();
     }
 }
コード例 #2
0
ファイル: Listings.class.php プロジェクト: mozdial/Directory
 function __construct($id = '')
 {
     parent::__construct();
     $this->show_expired_listings = ModulesSettings::Get('listings', 'show_expired_listings');
     if ($id != '') {
         $this->__construct_single($id);
     } else {
         $this->__construct_all();
     }
 }
コード例 #3
0
 function __construct($module_name = '')
 {
     parent::__construct();
     global $objLogin;
     $this->moduleName = $module_name;
     $this->primaryKey = 'id';
     $this->tableName = TABLE_MODULES_SETTINGS;
     $this->isFilteringAllowed = false;
     if ($objLogin->IsLoggedInAsAdmin()) {
         $this->__construct_admin();
     }
     $this->__construct_public();
 }
コード例 #4
0
ファイル: Countries.class.php プロジェクト: mozdial/Directory
    function __construct($id = '')
    {
        parent::__construct();
        $this->params = array();
        ## for standard fields
        if (isset($_POST['name'])) {
            $this->params['name'] = prepare_input($_POST['name']);
        }
        if (isset($_POST['abbrv'])) {
            $this->params['abbrv'] = prepare_input($_POST['abbrv']);
        }
        if (isset($_POST['is_active'])) {
            $this->params['is_active'] = (int) $_POST['is_active'];
        }
        if (isset($_POST['is_default'])) {
            $this->params['is_default'] = (int) $_POST['is_default'];
        }
        if (isset($_POST['priority_order'])) {
            $this->params['priority_order'] = prepare_input($_POST['priority_order']);
        }
        $this->id = $id;
        if ($this->id != '') {
            $sql = 'SELECT
						id, abbrv, name, is_active, is_default, priority_order
					FROM ' . TABLE_COUNTRIES . '
					WHERE id = \'' . (int) $this->id . '\'';
            $this->countries = database_query($sql, DATA_ONLY, FIRST_ROW_ONLY);
        } else {
            $this->countries['id'] = '';
            $this->countries['abbrv'] = '';
            $this->countries['name'] = '';
            $this->countries['is_active'] = '';
            $this->countries['is_default'] = '';
            $this->countries['priority_order'] = '';
        }
        // $this->params['language_id'] 	  = MicroGrid::GetParameter('language_id');
        $this->primaryKey = 'id';
        $this->tableName = TABLE_COUNTRIES;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=countries_management';
        $this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowLanguages = false;
        //$this->languageId  	= ($this->params['language_id'] != '') ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = '';
        // WHERE .... / 'WHERE language_id = \''.$this->languageId.'\'';
        $this->ORDER_CLAUSE = 'ORDER BY priority_order DESC, name ASC';
        // ORDER BY '.$this->tableName.'.date_created DESC
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isFilteringAllowed = true;
        $arr_default_types = array('0' => _NO, '1' => _YES);
        $arr_activity_types = array('0' => _NO, '1' => _YES);
        // define filtering fields
        $this->arrFilteringFields = array(_NAME => array('table' => $this->tableName, 'field' => 'name', 'type' => 'text', 'sign' => 'like%', 'width' => '100px'), _ACTIVE => array('table' => $this->tableName, 'field' => 'is_active', 'type' => 'dropdownlist', 'source' => $arr_activity_types, 'sign' => '=', 'width' => '90px', 'visible' => true));
        //----------------------------------------------------------------------
        // VIEW MODE
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
									abbrv,
									name,
									IF(is_default, \'<span class=yes>' . _YES . '</span>\', \'<span class=gray>' . _NO . '</span>\') as mod_is_default,
									IF(is_active, \'<span class=yes>' . _YES . '</span>\', \'<span class=no>' . _NO . '</span>\') as mod_is_active,
									priority_order
								FROM ' . $this->tableName;
        // define view mode fields
        $this->arrViewModeFields = array('name' => array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => '', 'height' => '', 'maxlength' => ''), 'abbrv' => array('title' => _ABBREVIATION, 'type' => 'label', 'align' => 'center', 'width' => '110px', 'height' => '', 'maxlength' => ''), 'mod_is_default' => array('title' => _DEFAULT, 'type' => 'label', 'align' => 'center', 'width' => '80px', 'height' => '', 'maxlength' => ''), 'mod_is_active' => array('title' => _ACTIVE, 'type' => 'label', 'align' => 'center', 'width' => '80px', 'height' => '', 'maxlength' => ''), 'priority_order' => array('title' => _ORDER, 'type' => 'label', 'align' => 'center', 'width' => '100px', 'height' => '', 'maxlength' => ''));
        //----------------------------------------------------------------------
        // ADD MODE
        // Validation Type: alpha|numeric|float|alpha_numeric|text|email
        // Validation Sub-Type: positive (for numeric and float)
        // Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array('name' => array('title' => _NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'maxlength' => '70', 'default' => '', 'validation_type' => 'text'), 'abbrv' => array('title' => _ABBREVIATION, 'type' => 'textbox', 'width' => '40px', 'required' => true, 'readonly' => false, 'unique' => true, 'maxlength' => '2', 'default' => '', 'validation_type' => 'alpha'), 'is_default' => array('title' => _DEFAULT, 'type' => 'enum', 'required' => true, 'width' => '90px', 'readonly' => false, 'default' => '0', 'source' => $arr_default_types, 'unique' => false, 'javascript_event' => ''), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'required' => true, 'width' => '90px', 'readonly' => false, 'default' => '1', 'source' => $arr_activity_types, 'unique' => false, 'javascript_event' => ''), 'priority_order' => array('title' => _ORDER, 'type' => 'textbox', 'width' => '50px', 'required' => true, 'readonly' => false, 'maxlength' => '4', 'default' => '0', 'validation_type' => 'numeric'));
        //----------------------------------------------------------------------
        // EDIT MODE
        // Validation Type: alpha|numeric|float|alpha_numeric|text|email
        // Validation Sub-Type: positive (for numeric and float)
        // Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.name,
								' . $this->tableName . '.abbrv,
								' . $this->tableName . '.is_active,
								' . $this->tableName . '.is_default,
								IF(is_default, \'<span class=yes>' . _YES . '</span>\', \'<span class=gray>' . _NO . '</span>\') as mod_is_default,
								IF(is_active, \'<span class=yes>' . _YES . '</span>\', \'<span class=no>' . _NO . '</span>\') as mod_is_active,
								' . $this->tableName . '.priority_order
							FROM ' . $this->tableName . '
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('name' => array('title' => _NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'maxlength' => '70', 'default' => '', 'validation_type' => 'text'), 'abbrv' => array('title' => _ABBREVIATION, 'type' => 'textbox', 'width' => '40px', 'required' => true, 'readonly' => false, 'unique' => true, 'maxlength' => '2', 'default' => '', 'validation_type' => 'alpha'), 'is_default' => array('title' => _DEFAULT, 'type' => 'enum', 'required' => true, 'width' => '90px', 'readonly' => false, 'default' => '1', 'source' => $arr_default_types, 'unique' => false, 'javascript_event' => ''), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'required' => true, 'width' => '90px', 'readonly' => false, 'default' => '1', 'source' => $arr_activity_types, 'unique' => false, 'javascript_event' => ''), 'priority_order' => array('title' => _ORDER, 'type' => 'textbox', 'width' => '50px', 'required' => true, 'readonly' => false, 'maxlength' => '4', 'default' => '0', 'validation_type' => 'numeric'));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('name' => array('title' => _NAME, 'type' => 'label'), 'abbrv' => array('title' => _ABBREVIATION, 'type' => 'label'), 'mod_is_default' => array('title' => _DEFAULT, 'type' => 'label'), 'mod_is_active' => array('title' => _ACTIVE, 'type' => 'label'), 'priority_order' => array('title' => _ORDER, 'type' => 'label'));
    }
コード例 #5
0
    function __construct($inq_id, $customer_id = 0)
    {
        parent::__construct();
        $this->params = array();
        ## for standard fields
        if (isset($_POST['inquiry_id'])) {
            $this->params['inquiry_id'] = prepare_input($_POST['inquiry_id']);
        }
        if (isset($_POST['customer_id'])) {
            $this->params['customer_id'] = prepare_input($_POST['customer_id']);
        }
        if (isset($_POST['date_added'])) {
            $this->params['date_added'] = prepare_input($_POST['date_added']);
        }
        if (isset($_POST['message'])) {
            $this->params['message'] = prepare_input($_POST['message']);
        }
        ## for checkboxes
        //$this->params['field4'] = isset($_POST['field4']) ? prepare_input($_POST['field4']) : '0';
        ## for images (not necessary)
        //if(isset($_POST['icon'])){
        //	$this->params['icon'] = prepare_input($_POST['icon']);
        //}else if(isset($_FILES['icon']['name']) && $_FILES['icon']['name'] != ''){
        //	// nothing
        //}else if (self::GetParameter('action') == 'create'){
        //	$this->params['icon'] = '';
        //}
        ## for files:
        // define nothing
        ///$this->params['language_id'] = MicroGrid::GetParameter('language_id');
        //$this->uPrefix 		= 'prefix_';
        $this->primaryKey = 'id';
        $this->tableName = TABLE_INQUIRIES_REPLIES;
        // TABLE_NAME
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = (!empty($customer_id) ? 'index.php?customer=inquiries_reply' : 'index.php?admin=mod_inquiries_reply') . '&inq_id=' . (int) $inq_id;
        $this->actions = array('add' => false, 'edit' => false, 'details' => true, 'delete' => false);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowTopButtons = false;
        $this->alertOnDelete = '';
        // leave empty to use default alerts
        $this->allowLanguages = false;
        $this->languageId = '';
        // ($this->params['language_id'] != '') ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = 'WHERE ir.inquiry_id = ' . (int) $inq_id . (!empty($customer_id) ? ' AND customer_id = ' . (int) $customer_id : '');
        $this->GROUP_BY_CLAUSE = '';
        // GROUP BY '.$this->tableName.'.order_number
        $this->ORDER_CLAUSE = 'ORDER BY ir.date_added DESC';
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isExportingAllowed = false;
        $this->arrExportingTypes = array('csv' => false);
        $this->isFilteringAllowed = false;
        // define filtering fields
        $this->arrFilteringFields = array();
        ///$this->isAggregateAllowed = false;
        ///// define aggregate fields for View Mode
        ///$this->arrAggregateFields = array(
        ///	'field1' => array('function'=>'SUM', 'align'=>'center', 'aggregate_by'=>'', 'decimal_place'=>2),
        ///	'field2' => array('function'=>'AVG', 'align'=>'center', 'aggregate_by'=>'', 'decimal_place'=>2),
        ///);
        ///$date_format = get_date_format('view');
        ///$date_format_settings = get_date_format('view', true); /* to get pure settings format */
        ///$date_format_edit = get_date_format('edit');
        $datetime_format = get_datetime_format();
        ///$time_format = get_time_format(); /* by default 1st param - shows seconds */
        ///$currency_format = get_currency_format();
        // prepare languages array
        /// $total_languages = Languages::GetAllActive();
        /// $arr_languages      = array();
        /// foreach($total_languages[0] as $key => $val){
        /// 	$arr_languages[$val['abbreviation']] = $val['lang_name'];
        /// }
        ///////////////////////////////////////////////////////////////////////////////
        // #002. prepare translation fields array
        /// $this->arrTranslations = $this->PrepareTranslateFields(
        ///	array('field1', 'field2')
        /// );
        ///////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////
        // #003. prepare translations array for add/edit/detail modes
        /// REMEMBER! to add '.$sql_translation_description.' in EDIT_MODE_SQL
        /// $sql_translation_description = $this->PrepareTranslateSql(
        ///	TABLE_XXX_DESCRIPTION,
        ///	'gallery_album_id',
        ///	array('field1', 'field2')
        /// );
        ///////////////////////////////////////////////////////////////////////////////
        //----------------------------------------------------------------------
        // VIEW MODE
        // format: strip_tags, nl2br, readonly_text
        // format: 'format'=>'date', 'format_parameter'=>'M d, Y, g:i A'
        // format: 'format'=>'currency', 'format_parameter'=>'european|2' or 'format_parameter'=>'american|4'
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ir.' . $this->primaryKey . ',
									ir.inquiry_id,
									ir.customer_id,
									ir.message,
									ir.date_added,
									CONCAT(c.first_name, \' \', c.last_name) as customer_name
								FROM ' . $this->tableName . ' ir
									INNER JOIN ' . TABLE_CUSTOMERS . ' c ON ir.customer_id = c.id
								';
        // define view mode fields
        $this->arrViewModeFields = array('customer_name' => array('title' => _CUSTOMER, 'type' => 'label', 'align' => 'left', 'width' => '', 'sortable' => true, 'nowrap' => '', 'visible' => true, 'tooltip' => '', 'maxlength' => '', 'format' => '', 'format_parameter' => ''), 'date_added' => array('title' => _DATE_ADDED, 'type' => 'label', 'align' => 'left', 'width' => '200px', 'header' => '', 'maxlength' => '', 'format' => 'date', 'format_parameter' => $datetime_format));
        //----------------------------------------------------------------------
        // ADD MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address|password|date
        // 	 Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255... Ex.: 'validation_maxlength'=>'255'
        // - Validation Min Length: 4, 6... Ex.: 'validation_minlength'=>'4'
        // - Validation Max Value: 12, 255... Ex.: 'validation_maximum'=>'99.99'
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array('message' => array('title' => _MESSAGE, 'type' => 'textarea', 'width' => '510px', 'required' => true, 'readonly' => false, 'maxlength' => '2048', 'default' => '', 'height' => '200px', 'editor_type' => 'simple|wysiwyg', 'validation_type' => '', 'unique' => false, 'visible' => true), 'customer_id' => array('title' => '', 'type' => 'hidden', 'required' => true, 'readonly' => false, 'default' => $customer_id), 'inquiry_id' => array('title' => '', 'type' => 'hidden', 'required' => true, 'readonly' => false, 'default' => $inq_id), 'date_added' => array('title' => '', 'type' => 'hidden', 'required' => true, 'readonly' => false, 'default' => date('Y-m-d H:i:s')));
        //----------------------------------------------------------------------
        // EDIT MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address|password|date
        //   Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255... Ex.: 'validation_maxlength'=>'255'
        // - Validation Min Length: 4, 6... Ex.: 'validation_minlength'=>'4'
        // - Validation Max Value: 12, 255... Ex.: 'validation_maximum'=>'99.99'
        // - for editable passwords they must be defined directly in SQL : '.$this->tableName.'.user_password,
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.inquiry_id,
								' . $this->tableName . '.customer_id,
								' . $this->tableName . '.message,
								' . $this->tableName . '.date_added,
								CONCAT(c.first_name, \' \', c.last_name) as customer_name
							FROM ' . $this->tableName . '
								INNER JOIN ' . TABLE_CUSTOMERS . ' c ON ' . $this->tableName . '.customer_id = c.id
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('customer_name' => array('title' => _CUSTOMER, 'type' => 'label', 'format' => '', 'format_parameter' => '', 'visible' => true), 'date_added' => array('title' => _DATE_ADDED, 'type' => 'date', 'required' => true, 'readonly' => true, 'unique' => false, 'visible' => true, 'default' => '', 'validation_type' => 'date', 'format' => 'date', 'format_parameter' => $datetime_format, 'min_year' => '90', 'max_year' => '10'), 'message' => array('title' => _MESSAGE, 'type' => 'textarea', 'width' => '510px', 'required' => false, 'readonly' => true, 'maxlength' => '', 'default' => '', 'height' => '200px', 'editor_type' => 'simple|wysiwyg', 'validation_type' => '', 'unique' => false, 'visible' => true));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('customer_name' => array('title' => _CUSTOMER, 'type' => 'label', 'format' => '', 'format_parameter' => '', 'visible' => true), 'date_added' => array('title' => _DATE_ADDED, 'type' => 'datetime', 'format' => 'date', 'format_parameter' => $datetime_format, 'visible' => true), 'message' => array('title' => _MESSAGE, 'type' => 'html', 'visible' => true));
        ///////////////////////////////////////////////////////////////////////////////
        // #004. add translation fields to all modes
        /// $this->AddTranslateToModes(
        /// $this->arrTranslations,
        /// array('name'        => array('title'=>_NAME, 'type'=>'textbox', 'width'=>'410px', 'required'=>true, 'maxlength'=>'', 'readonly'=>false),
        /// 	  'description' => array('title'=>_DESCRIPTION, 'type'=>'textarea', 'width'=>'410px', 'height'=>'90px', 'required'=>false, 'maxlength'=>'', 'maxlength'=>'512', 'validation_maxlength'=>'512', 'readonly'=>false)
        /// )
        /// );
        ///////////////////////////////////////////////////////////////////////////////
    }
コード例 #6
0
ファイル: PagesGrid.class.php プロジェクト: mozdial/Directory
    function __construct($type = '', $actions = array())
    {
        parent::__construct();
        $this->params = array();
        ///if(isset($_POST['parameter1']))   $this->params['parameter1'] = $_POST['parameter1'];
        ///if(isset($_POST['parameter2']))   $this->params['parameter2'] = $_POST['parameter2'];
        ///if(isset($_POST['parameter3']))   $this->params['parameter3'] = $_POST['parameter3'];
        // for checkboxes
        ///if(isset($_POST['parameter4']))   $this->params['parameter4'] = $_POST['parameter4']; else $this->params['parameter4'] = '0';
        $this->params['language_id'] = MicroGrid::GetParameter('language_id');
        $this->primaryKey = 'id';
        $this->tableName = TABLE_PAGES;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=pages' . ($type != '' ? '&type=' . $type : '');
        $this->actions = array('add' => false, 'edit' => false, 'details' => false, 'delete' => false);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowLanguages = true;
        $this->languageId = $this->params['language_id'] != '' ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = 'WHERE
									' . $this->tableName . '.is_system_page = ' . ($type == 'system' ? '1' : '0') . ' AND 
									' . $this->tableName . '.is_home = 0 AND
									' . $this->tableName . '.is_removed = 0 AND
									' . $this->tableName . '.language_id = \'' . $this->languageId . '\'';
        $this->ORDER_CLAUSE = 'ORDER BY priority_order ASC';
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isFilteringAllowed = $type == 'system' ? false : true;
        // prepare menus array
        $total_menus = Menu::GetAll(' menu_order ASC', TABLE_MENUS, '', $this->languageId);
        $arr_menus = array();
        foreach ($total_menus[0] as $key => $val) {
            $arr_menus[$val['id']] = $val['menu_name'] . ($val['menu_placement'] == 'hidden' ? ' (' . _HIDDEN . ')' : '');
        }
        // define filtering fields
        $this->arrFilteringFields = array(_MENU_WORD => array('table' => TABLE_MENUS, 'field' => 'id', 'type' => 'dropdownlist', 'source' => $arr_menus, 'sign' => '=', 'width' => '150px'));
        // prepare languages array
        $total_languages = Languages::GetAllActive();
        $arr_languages = array();
        foreach ($total_languages[0] as $key => $val) {
            $arr_languages[$val['abbreviation']] = $val['lang_name'];
        }
        $comments_allow = Modules::IsModuleInstalled('comments') ? ModulesSettings::Get('comments', 'comments_allow') : 'no';
        //----------------------------------------------------------------------
        // VIEW MODE
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->tableName . '.' . $this->primaryKey . ',
									' . $this->tableName . '.language_id,
									' . $this->tableName . '.content_type,
									' . $this->tableName . '.link_url,
									' . $this->tableName . '.link_target,
									' . $this->tableName . '.page_key,
									IF(' . $this->tableName . '.page_title != "", ' . $this->tableName . '.page_title, "- ' . _UNDEFINED . ' -") as page_title,
									' . $this->tableName . '.page_text,
									' . $this->tableName . '.menu_id,
									IF(' . $this->tableName . '.menu_link != "", ' . $this->tableName . '.menu_link, "- ' . _UNDEFINED . ' -") as menu_link,
									' . $this->tableName . '.comments_allowed,
									' . $this->tableName . '.is_home,
									' . $this->tableName . '.priority_order,
									IF(' . $this->tableName . '.access_level = "public", "' . _PUBLIC . '", "' . _REGISTERED . '") my_access_level,
									CASE
										WHEN ' . $this->tableName . '.is_published = 1 THEN
											IF(
												(finish_publishing = "0000-00-00" OR finish_publishing >= \'' . date('Y-m-d') . '\'),
												"<img src=\\"images/published_g.gif\\" alt=\\"\\" />",
												"<img src=\\"images/expired.gif\\" alt=\\"' . _EXPIRED . '\\" />"
											  ) 		
										ELSE "<img src=\\"images/published_x.gif\\" alt=\\"\\" />"
									END as is_published,
									IF(' . TABLE_MENUS . '.menu_name != "", ' . TABLE_MENUS . '.menu_name, "' . _NOT_AVAILABLE . '") as menu_name,
									CASE
										WHEN ' . $this->tableName . '.comments_allowed = 1 THEN
											CONCAT("<a href=\\"index.php?admin=mod_comments_management&pid=",
											' . $this->tableName . '.' . $this->primaryKey . ', "\\">", (SELECT COUNT(*) FROM ' . TABLE_COMMENTS . ' c WHERE c.article_id = ' . $this->tableName . '.' . $this->primaryKey . '),											
											(SELECT IF(COUNT(*) > 0, CONCAT("(",COUNT(*),")"), "") FROM ' . TABLE_COMMENTS . ' c WHERE c.is_published = 0 AND c.article_id = ' . $this->tableName . '.' . $this->primaryKey . '),
											"</a>")
										ELSE
											"<span class=gray>' . _NOT_ALLOWED . '</span>"
									END as comments_count,
									CONCAT(
										" <a href=\\"index.php?page=pages' . ($type == 'system' ? '&type=' . $type : '') . '&pid=", ' . $this->tableName . '.' . $this->primaryKey . ', "&mg_language_id=' . $this->languageId . '\\">' . _VIEW_WORD . '</a>
										' . ($actions['edit'] ? ' | <a href=\\"index.php?admin=pages_edit' . ($type != '' ? '&type=' . $type : '') . '&pid=", ' . $this->tableName . '.' . $this->primaryKey . ', "\\">' . _EDIT_WORD . '</a>' : '') . '
										' . ($actions['delete'] && $type != 'system' ? ' | <a href=\\"javascript:confirmRemoving(\'", ' . $this->tableName . '.' . $this->primaryKey . ', "\')\\">' . _REMOVE . '</a>' : '') . '
										") as action_links
								FROM ' . $this->tableName . '
									LEFT OUTER JOIN ' . TABLE_MENUS . ' ON ' . $this->tableName . '.menu_id=' . TABLE_MENUS . '.id';
        // define view mode fields
        $this->arrViewModeFields = array();
        $this->arrViewModeFields['menu_link'] = array('title' => _MENU_LINK, 'type' => 'label', 'align' => 'left', 'width' => '', 'maxlength' => '40');
        if ($type == 'system') {
            $this->arrViewModeFields['page_title'] = array('title' => _PAGE_HEADER, 'type' => 'label', 'align' => 'left', 'width' => '', 'maxlength' => '40');
        }
        $this->arrViewModeFields['menu_name'] = array('title' => _MENU_WORD, 'type' => 'label', 'align' => 'center', 'width' => '', 'visible' => $type == 'system' ? false : true);
        $this->arrViewModeFields['is_published'] = array('title' => _PUBLISHED, 'type' => 'label', 'align' => 'center', 'width' => '80px');
        $this->arrViewModeFields['my_access_level'] = array('title' => _ACCESS, 'type' => 'label', 'align' => 'center', 'width' => '75px');
        $this->arrViewModeFields['priority_order'] = array('title' => _ORDER, 'type' => 'label', 'align' => 'center', 'width' => '65px', 'visible' => 'true', 'movable' => true);
        $this->arrViewModeFields['comments_count'] = array('title' => _COMMENTS, 'type' => 'label', 'align' => 'center', 'width' => '90px', 'visible' => $comments_allow == 'yes' ? true : false);
        $this->arrViewModeFields['id'] = array('title' => 'ID', 'type' => 'label', 'align' => 'center', 'width' => '50px');
        $this->arrViewModeFields['action_links'] = array('title' => _ACTIONS, 'type' => 'label', 'align' => 'center', 'sortable' => false, 'nowrap' => 'nowrap', 'width' => $type == 'system' ? '90px' : '130px');
        //----------------------------------------------------------------------
        // ADD MODE
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array();
        //----------------------------------------------------------------------
        // EDIT MODE
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.parameter1,
								' . $this->tableName . '.parameter2,
								' . $this->tableName . '.parameter3
							FROM ' . $this->tableName . '
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array();
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array();
    }
コード例 #7
0
    function __construct($lid)
    {
        parent::__construct();
        $this->params = array();
        ## for standard fields
        if (isset($_POST['name'])) {
            $this->params['name'] = prepare_input($_POST['name']);
        }
        if (isset($_POST['location_id'])) {
            $this->params['location_id'] = prepare_input($_POST['location_id']);
        }
        // $this->params['language_id'] 	  = MicroGrid::GetParameter('language_id');
        $this->primaryKey = 'id';
        $this->tableName = TABLE_LISTINGS_SUB_LOCATIONS;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=mod_listings_sub_locations&lid=' . (int) $lid;
        $this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowLanguages = false;
        //$this->languageId  	= ($this->params['language_id'] != '') ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = 'WHERE location_id = ' . (int) $lid;
        $this->ORDER_CLAUSE = 'ORDER BY name ASC';
        // ORDER BY '.$this->tableName.'.date_created DESC
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 100;
        $this->isSortingAllowed = true;
        $this->isFilteringAllowed = true;
        $arr_default_types = array('0' => _NO, '1' => _YES);
        $arr_activity_types = array('0' => _NO, '1' => _YES);
        // define filtering fields
        $this->arrFilteringFields = array(_NAME => array('table' => $this->tableName, 'field' => 'name', 'type' => 'text', 'sign' => 'like%', 'width' => '100px'));
        //----------------------------------------------------------------------
        // VIEW MODE
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
									name
								FROM ' . $this->tableName;
        // define view mode fields
        $this->arrViewModeFields = array('name' => array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => '', 'height' => '', 'maxlength' => ''));
        //----------------------------------------------------------------------
        // ADD MODE
        // Validation Type: alpha|numeric|float|alpha_numeric|text|email
        // Validation Sub-Type: positive (for numeric and float)
        // Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array('name' => array('title' => _NAME, 'type' => 'textbox', 'width' => '240px', 'required' => true, 'readonly' => false, 'maxlength' => '50', 'default' => '', 'validation_type' => 'text'), 'location_id' => array('title' => '', 'type' => 'hidden', 'required' => true, 'readonly' => false, 'default' => $lid));
        //----------------------------------------------------------------------
        // EDIT MODE
        // Validation Type: alpha|numeric|float|alpha_numeric|text|email
        // Validation Sub-Type: positive (for numeric and float)
        // Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.name
							FROM ' . $this->tableName . '
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('name' => array('title' => _NAME, 'type' => 'textbox', 'width' => '240px', 'required' => true, 'readonly' => false, 'maxlength' => '50', 'default' => '', 'validation_type' => 'text'), 'location_id' => array('title' => '', 'type' => 'hidden', 'required' => true, 'readonly' => false, 'default' => $lid));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('name' => array('title' => _NAME, 'type' => 'label'));
    }
コード例 #8
0
    function __construct()
    {
        parent::__construct();
        $this->params = array();
        global $objSettings;
        ## for standard fields
        if (isset($_POST['template_code'])) {
            $this->params['template_code'] = prepare_input($_POST['template_code']);
        }
        if (isset($_POST['template_name'])) {
            $this->params['template_name'] = prepare_input($_POST['template_name']);
        }
        if (isset($_POST['template_subject'])) {
            $this->params['template_subject'] = prepare_input($_POST['template_subject']);
        }
        if (isset($_POST['template_content'])) {
            $this->params['template_content'] = prepare_input($_POST['template_content'], false, 'medium');
        }
        $this->params['language_id'] = MicroGrid::GetParameter('language_id');
        //$this->uPrefix 		= 'prefix_';
        $this->primaryKey = 'id';
        $this->tableName = TABLE_EMAIL_TEMPLATES;
        if (self::$PROJECT == 'ShoppingCart' || self::$PROJECT == 'BusinessDirectory' || self::$PROJECT == 'HotelSite') {
            $this->TABLE_NAME = TABLE_CUSTOMERS;
            $this->MODULE_NAME = 'customers';
            $this->MEMBERS_NAME = _CUSTOMERS;
            $this->ADMINS_MEMBERS_NAME = _ADMINS_AND_CUSTOMERS;
        } else {
            if (self::$PROJECT == 'MedicalAppointment') {
                $this->TABLE_NAME = TABLE_PATIENTS;
                $this->MODULE_NAME = 'patients';
                $this->MEMBERS_NAME = _PATIENTS;
                $this->ADMINS_MEMBERS_NAME = _ADMINS_AND_PATIENTS;
            } else {
                $this->TABLE_NAME = TABLE_USERS;
                $this->MODULE_NAME = 'users';
                $this->MEMBERS_NAME = _USERS;
                $this->ADMINS_MEMBERS_NAME = _ADMINS_AND_USERS;
            }
        }
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=email_templates';
        $this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowLanguages = true;
        $this->languageId = $this->params['language_id'] != '' ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = 'WHERE language_id = \'' . $this->languageId . '\'';
        $this->ORDER_CLAUSE = 'ORDER BY ' . $this->tableName . '.template_code ASC';
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 25;
        $this->isSortingAllowed = true;
        $this->isFilteringAllowed = false;
        // define filtering fields
        $this->arrFilteringFields = array();
        $arr_is_system = array('0' => '<span class=no>' . _NO . '</span>', '1' => '<span class=yes>' . _YES . '</span>');
        // prepare languages array
        $total_languages = Languages::GetAllActive();
        $arr_languages = array();
        foreach ($total_languages[0] as $key => $val) {
            $arr_languages[$val['abbreviation']] = $val['lang_name'];
        }
        $wysiwyg_type = $objSettings->GetParameter('mailer_wysiwyg_type') == 'tinymce' ? 'wysiwyg' : 'simple';
        //----------------------------------------------------------------------
        // VIEW MODE
        // format: strip_tags
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
									language_id,
									template_code,
									template_name,
									template_subject,
									template_content,
									is_system_template
								FROM ' . $this->tableName;
        // define view mode fields
        $this->arrViewModeFields = array('template_subject' => array('title' => _SUBJECT, 'type' => 'label', 'align' => 'left', 'width' => '35%', 'sortable' => true, 'nowrap' => 'wrap', 'visible' => '', 'height' => '', 'maxlength' => '50', 'format' => ''), 'template_name' => array('title' => _DESCRIPTION, 'type' => 'label', 'align' => 'left', 'width' => '', 'sortable' => true, 'nowrap' => 'wrap', 'visible' => '', 'height' => '', 'maxlength' => '65', 'format' => ''), 'is_system_template' => array('title' => _SYSTEM, 'type' => 'enum', 'align' => 'center', 'width' => '80px', 'sortable' => true, 'nowrap' => '', 'visible' => true, 'source' => $arr_is_system));
        //----------------------------------------------------------------------
        // ADD MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address
        // 	 Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255 ....
        //   Ex.: 'validation_maxlength'=>'255'
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array('language_id' => array('title' => _LANGUAGE, 'type' => 'enum', 'required' => true, 'readonly' => true, 'width' => '210px', 'source' => $arr_languages, 'unique' => false), 'template_code' => array('title' => _TEMPLATE_CODE, 'type' => 'textbox', 'width' => '350px', 'required' => true, 'readonly' => false, 'maxlength' => '40', 'default' => '', 'validation_type' => 'alpha_numeric', 'unique' => true), 'template_name' => array('title' => _DESCRIPTION, 'type' => 'textbox', 'width' => '350px', 'required' => true, 'readonly' => false, 'maxlength' => '100', 'default' => '', 'validation_type' => '', 'unique' => true), 'template_subject' => array('title' => _SUBJECT, 'type' => 'textbox', 'width' => '510px', 'required' => true, 'readonly' => false, 'maxlength' => '125', 'default' => '', 'validation_type' => '', 'unique' => false), 'template_content' => array('title' => _TEXT, 'type' => 'textarea', 'width' => '530px', 'height' => '290px', 'required' => true, 'editor_type' => $wysiwyg_type, 'maxlength' => '4096', 'validation_maxlength' => '4096', 'readonly' => false, 'default' => '', 'validation_type' => '', 'unique' => false), 'is_system_template' => array('title' => '', 'type' => 'hidden', 'required' => true, 'readonly' => false, 'default' => '0'));
        //----------------------------------------------------------------------
        // EDIT MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address
        //   Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255 ....
        //   Ex.: 'validation_maxlength'=>'255'
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.language_id,
								' . $this->tableName . '.template_name,
								' . $this->tableName . '.template_code,
								' . $this->tableName . '.template_subject,
								' . $this->tableName . '.template_content,
								' . $this->tableName . '.is_system_template
							FROM ' . $this->tableName . '
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('language_id' => array('title' => _LANGUAGE, 'type' => 'enum', 'required' => true, 'readonly' => true, 'width' => '210px', 'source' => $arr_languages, 'unique' => false), 'template_code' => array('title' => _TEMPLATE_CODE, 'type' => 'label'), 'template_name' => array('title' => _DESCRIPTION, 'type' => 'textbox', 'width' => '350px', 'required' => true, 'readonly' => false, 'maxlength' => '100', 'default' => '', 'validation_type' => '', 'unique' => false), 'template_subject' => array('title' => _SUBJECT, 'type' => 'textbox', 'width' => '510px', 'required' => true, 'readonly' => false, 'maxlength' => '125', 'default' => '', 'validation_type' => '', 'unique' => false), 'template_content' => array('title' => _TEXT, 'type' => 'textarea', 'width' => '530px', 'height' => '300px', 'required' => true, 'editor_type' => $wysiwyg_type, 'maxlength' => '4096', 'validation_maxlength' => '4096', 'readonly' => false, 'default' => '', 'validation_type' => '', 'unique' => false), 'is_system_template' => array('title' => _SYSTEM_TEMPLATE, 'type' => 'enum', 'readonly' => true, 'source' => $arr_is_system));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('template_name' => array('title' => _DESCRIPTION, 'type' => 'label'), 'template_subject' => array('title' => _SUBJECT, 'type' => 'label'), 'template_content' => array('title' => _TEXT, 'type' => 'label', 'format' => 'readonly_text'), 'is_system_template' => array('title' => _SYSTEM_TEMPLATE, 'type' => 'enum', 'source' => $arr_is_system));
    }
コード例 #9
0
ファイル: Inquiries.class.php プロジェクト: mozdial/Directory
    function __construct()
    {
        parent::__construct();
        global $objSettings, $objLogin;
        $this->params = array();
        ## for standard fields
        if (isset($_POST['name'])) {
            $this->params['name'] = prepare_input($_POST['name']);
        }
        if (isset($_POST['email'])) {
            $this->params['email'] = prepare_input($_POST['email']);
        }
        if (isset($_POST['phone'])) {
            $this->params['phone'] = prepare_input($_POST['phone']);
        }
        if (isset($_POST['availability'])) {
            $this->params['availability'] = prepare_input($_POST['availability']);
        }
        if (isset($_POST['preferred_contact'])) {
            $this->params['preferred_contact'] = prepare_input($_POST['preferred_contact']);
        }
        if (isset($_POST['description'])) {
            $this->params['description'] = prepare_input($_POST['description']);
        }
        if (isset($_POST['date_created'])) {
            $this->params['date_created'] = prepare_input($_POST['date_created']);
        }
        if (isset($_POST['replies_count'])) {
            $this->params['replies_count'] = prepare_input($_POST['replies_count']);
        }
        ## for checkboxes
        $this->params['is_active'] = isset($_POST['is_active']) ? prepare_input($_POST['is_active']) : '0';
        ## for images
        //if(isset($_POST['icon'])){
        //	$this->params['icon'] = $_POST['icon'];
        //}else if(isset($_FILES['icon']['name']) && $_FILES['icon']['name'] != ''){
        //	// nothing
        //}else if (self::GetParameter('action') == 'create'){
        //	$this->params['icon'] = '';
        //}
        $this->params['language_id'] = '';
        //MicroGrid::GetParameter('language_id');
        //$this->uPrefix 		= 'prefix_';
        $this->primaryKey = 'id';
        $this->tableName = TABLE_INQUIRIES;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?' . ($objLogin->IsLoggedInAsAdmin() ? 'admin=mod_inquiries_management' : 'customer=inquiries');
        $this->actions = array('add' => false, 'edit' => $objLogin->IsLoggedInAs('owner') ? true : false, 'details' => true, 'delete' => $objLogin->IsLoggedInAs('owner') ? true : false);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowLanguages = false;
        $this->languageId = '';
        $visible = $objLogin->IsLoggedInAsCustomer() ? false : true;
        if ($objLogin->IsLoggedInAsCustomer()) {
            $this->WHERE_CLAUSE = 'WHERE ((
				i.inquiry_type = 1 AND
				i.listing_id IN (SELECT l.id FROM ' . TABLE_LISTINGS . ' l WHERE l.customer_id = ' . (int) $objLogin->GetLoggedId() . ')
			) OR (
				i.inquiry_type = 0 AND
				i.id IN (SELECT ih.inquiry_id FROM ' . TABLE_INQUIRIES_HISTORY . ' ih WHERE ih.customer_id = ' . (int) $objLogin->GetLoggedId() . ')
			))';
        } else {
            $this->WHERE_CLAUSE = '';
        }
        $this->ORDER_CLAUSE = 'ORDER BY i.date_created DESC';
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isFilteringAllowed = true;
        // define filtering fields
        $this->arrFilteringFields = array(_NAME => array('table' => 'i', 'field' => 'name', 'type' => 'text', 'sign' => 'like%', 'width' => '90px', 'visible' => true), _DATE_CREATED => array('table' => 'i', 'field' => 'date_created', 'type' => 'calendar', 'date_format' => $objSettings->GetParameter('date_format'), 'sign' => 'like%', 'width' => '85px', 'visible' => true));
        if ($objSettings->GetParameter('date_format') == 'mm/dd/yyyy') {
            $this->sqlFieldDatetimeFormat = '%b %d, %Y %H:%i';
        } else {
            $this->sqlFieldDatetimeFormat = '%d %b, %Y %H:%i';
        }
        $this->SetLocale(Application::Get('lc_time_name'));
        $arr_is_active = array('0' => '<span class=no>' . _NO . '</span>', '1' => '<span class=yes>' . _YES . '</span>');
        //$replies_count = $objLogin->IsLoggedInAsCustomer() ? 1 : ModulesSettings::Get('inquiries', 'maximum_replies');
        //----------------------------------------------------------------------
        // VIEW MODE
        // format: strip_tags
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT i.' . $this->primaryKey . ',
									i.inquiry_type,
									i.name,									
									i.email,
									i.phone,
									i.location_id,
									i.sub_location_id,
									i.availability,
									i.preferred_contact,
									i.description,
									i.is_active,
									DATE_FORMAT(i.date_created, \'' . $this->sqlFieldDatetimeFormat . '\') as date_created,
									i.replies_count,';
        if ($objLogin->IsLoggedInAsCustomer()) {
            $this->VIEW_MODE_SQL .= 'IF(											
											(
												SELECT ir.id
												FROM ' . TABLE_INQUIRIES_REPLIES . ' ir
													INNER JOIN ' . TABLE_CUSTOMERS . ' c ON ir.customer_id = c.id
												WHERE 
													ir.inquiry_id = i.id AND
													ir.customer_id = ' . (int) $objLogin->GetLoggedId() . ' 
												LIMIT 0, 1 
											) IS NULL,
											IF(i.is_active = 0, "' . _CLOSED . '", CONCAT("<a href=index.php?customer=inquiries_reply&inq_id=", i.' . $this->primaryKey . ', "&act=add>[ ' . _REPLY . ' ]</a>")),
											CONCAT("<a href=index.php?customer=inquiries_reply&inq_id=", i.' . $this->primaryKey . ', "> ' . _ANSWERED . ' </a>")
										) as link_reply_customer,
										"" as link_reply_admin,';
        } else {
            $this->VIEW_MODE_SQL .= '
											"" as link_reply_customer,
											CONCAT("<a href=index.php?admin=mod_inquiries_reply&inq_id=", i.' . $this->primaryKey . ', ">", IF((i.is_active = 1), "[ ' . _ACTIVE . ' ]", "' . _CLOSED . '"), "</a> (", i.replies_count, ")") as link_reply_admin,
										';
        }
        $this->VIEW_MODE_SQL .= 'CONCAT(ll.name, " / ", lsl.name) as location_name,
									lcd.name as category_name
								FROM ' . $this->tableName . ' i
									LEFT OUTER JOIN ' . TABLE_CATEGORIES_DESCRIPTION . ' lcd ON i.category_id = lcd.category_id AND lcd.language_id = \'' . Application::Get('lang') . '\'
									LEFT OUTER JOIN ' . TABLE_LISTINGS_LOCATIONS . ' ll ON i.location_id = ll.id
									LEFT OUTER JOIN ' . TABLE_LISTINGS_SUB_LOCATIONS . ' lsl ON i.sub_location_id = lsl.id
								';
        // define view mode fields
        $this->arrViewModeFields = array('name' => array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => '160px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'maxlength' => ''), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'link', 'href' => 'mailto:{email}', 'align' => 'left', 'width' => '', 'maxlength' => '36', 'visible' => $visible), 'category_name' => array('title' => _CATEGORY, 'align' => 'left', 'width' => '110px', 'sortable' => true, 'nowrap' => 'nowrap', 'visible' => '', 'maxlength' => ''), 'location_name' => array('title' => _LOCATION, 'align' => 'left', 'width' => '130px', 'sortable' => true, 'nowrap' => 'nowrap', 'visible' => '', 'maxlength' => ''), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'label', 'align' => 'left', 'width' => '120px', 'sortable' => true, 'nowrap' => 'nowrap', 'visible' => '', 'height' => '', 'maxlength' => ''), 'inquiry_type' => array('title' => _TYPE, 'type' => 'enum', 'align' => 'center', 'width' => '70px', 'source' => self::$arr_inquiry_types, 'visible' => true), 'link_reply_customer' => array('title' => _REPLIES, 'type' => 'label', 'align' => 'center', 'width' => '65px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'maxlength' => '', 'visible' => $objLogin->IsLoggedInAsCustomer()), 'link_reply_admin' => array('title' => _REPLIES, 'type' => 'label', 'align' => 'center', 'width' => '65px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'maxlength' => '', 'visible' => $objLogin->IsLoggedInAsAdmin()), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'align' => 'center', 'width' => '70px', 'sortable' => true, 'nowrap' => '', 'visible' => true, 'source' => $arr_is_active));
        //----------------------------------------------------------------------
        // ADD MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address
        // 	 Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255 ....
        //   Ex.: 'validation_maxlength'=>'255'
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array();
        //----------------------------------------------------------------------
        // EDIT MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address
        //   Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255 ....
        //   Ex.: 'validation_maxlength'=>'255'
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								i.inquiry_type,
								i.category_id,
								cd.name as category_name,
								i.listing_id,
								ld.business_name as listing_name,
								i.name,
								i.email,
								i.phone,
								i.availability,
								i.preferred_contact,
								i.description,
								DATE_FORMAT(i.date_created, \'' . $this->sqlFieldDatetimeFormat . '\') as date_created,
								i.replies_count,
								i.is_active,
								ll.name as location_name,
								lsl.name as sub_location_name
							FROM ' . $this->tableName . ' i
								LEFT OUTER JOIN ' . TABLE_CATEGORIES_DESCRIPTION . ' cd ON i.category_id = cd.category_id AND cd.language_id = \'' . Application::Get('lang') . '\'
								LEFT OUTER JOIN ' . TABLE_LISTINGS_DESCRIPTION . ' ld ON i.listing_id = ld.listing_id AND ld.language_id = \'' . Application::Get('lang') . '\'
								LEFT OUTER JOIN ' . TABLE_LISTINGS_LOCATIONS . ' ll ON i.location_id = ll.id
								LEFT OUTER JOIN ' . TABLE_LISTINGS_SUB_LOCATIONS . ' lsl ON i.sub_location_id = lsl.id
							WHERE i.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('separator_contact_information' => array('separator_info' => array('legend' => _CONTACT_INFORMATION, 'columns' => '0'), 'name' => array('title' => _NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'maxlength' => '50', 'default' => '', 'validation_type' => '', 'unique' => false, 'visible' => true), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'maxlength' => '70', 'default' => '', 'validation_type' => '', 'unique' => false, 'visible' => $visible), 'phone' => array('title' => _PHONE, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'maxlength' => '20', 'default' => '', 'validation_type' => '', 'unique' => false, 'visible' => true), 'location_name' => array('title' => _LOCATION, 'type' => 'label'), 'sub_location_name' => array('title' => _SUB_LOCATION, 'type' => 'label'), 'availability' => array('title' => _I_AM_AVAILABLE, 'type' => 'enum', 'width' => '', 'required' => true, 'readonly' => false, 'default' => '', 'source' => self::$arr_availabilities, 'default_option' => '', 'unique' => false, 'javascript_event' => '', 'view_type' => 'dropdownlist', 'multi_select' => false), 'preferred_contact' => array('title' => _PREFERRED_TO_BE_CONTACTED, 'type' => 'enum', 'width' => '', 'required' => true, 'readonly' => false, 'default' => '', 'source' => self::$arr_preferred_contacts, 'default_option' => '', 'unique' => false, 'javascript_event' => '', 'view_type' => 'dropdownlist', 'multi_select' => false)), 'separator_inquiry_details' => array('separator_info' => array('legend' => _INQUIRY_DETAILS, 'columns' => '0'), 'description' => array('title' => _DESCRIPTION, 'type' => 'textarea', 'width' => '410px', 'required' => false, 'readonly' => false, 'maxlength' => '2048', 'default' => '', 'height' => '90px', 'editor_type' => 'simple|wysiwyg', 'validation_type' => '', 'validation_maxlength' => '2048', 'unique' => false), 'inquiry_type' => array('title' => _TYPE, 'type' => 'enum', 'width' => '', 'required' => true, 'readonly' => true, 'default' => '', 'source' => self::$arr_inquiry_types, 'default_option' => '', 'unique' => false, 'javascript_event' => '', 'view_type' => 'dropdownlist', 'multi_select' => false), 'category_name' => array('title' => _CATEGORY, 'type' => 'label'), 'listing_name' => array('title' => _LISTING, 'type' => 'label'), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'label'), 'replies_count' => array('title' => _REPLIES, 'type' => 'label'), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'readonly' => false, 'default' => '1', 'true_value' => '1', 'false_value' => '0', 'unique' => false)));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('separator_contact_information' => array('separator_info' => array('legend' => _CONTACT_INFORMATION, 'columns' => '0'), 'name' => array('title' => _NAME, 'type' => 'label'), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'label', 'visible' => $visible), 'phone' => array('title' => _PHONE, 'type' => 'label', 'visible' => $visible), 'location_name' => array('title' => _LOCATION, 'type' => 'label'), 'sub_location_name' => array('title' => _SUB_LOCATION, 'type' => 'label'), 'availability' => array('title' => _I_AM_AVAILABLE, 'type' => 'enum', 'width' => '', 'required' => true, 'readonly' => false, 'default' => '', 'source' => self::$arr_availabilities, 'default_option' => '', 'unique' => false, 'javascript_event' => '', 'view_type' => 'dropdownlist', 'multi_select' => false), 'preferred_contact' => array('title' => _PREFERRED_TO_BE_CONTACTED, 'type' => 'enum', 'width' => '', 'required' => true, 'readonly' => false, 'default' => '', 'source' => self::$arr_preferred_contacts, 'default_option' => '', 'unique' => false, 'javascript_event' => '', 'view_type' => 'dropdownlist', 'multi_select' => false)), 'separator_inquiry_details' => array('separator_info' => array('legend' => _INQUIRY_DETAILS, 'columns' => '0'), 'description' => array('title' => _DESCRIPTION, 'type' => 'html'), 'inquiry_type' => array('title' => _TYPE, 'type' => 'enum', 'source' => self::$arr_inquiry_types, 'visible' => $visible), 'category_name' => array('title' => _CATEGORY, 'type' => 'label', 'visible' => $visible), 'listing_name' => array('title' => _LISTING, 'type' => 'label', 'visible' => $visible), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'label'), 'replies_count' => array('title' => _REPLIES, 'type' => 'label', 'visible' => $visible), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'source' => $arr_is_active)));
    }
コード例 #10
0
ファイル: Banners.class.php プロジェクト: mozdial/Directory
    function __construct()
    {
        parent::__construct();
        global $objLogin;
        $this->params = array();
        if (isset($_POST['link_url'])) {
            $link_url = prepare_input($_POST['link_url'], false, 'medium');
            if (preg_match('/www./i', $link_url) && !preg_match('/http:/i', $link_url)) {
                $link_url = 'http://' . $link_url;
            }
            $this->params['link_url'] = $link_url;
        }
        if (isset($_POST['priority_order'])) {
            $this->params['priority_order'] = prepare_input($_POST['priority_order']);
        }
        if (isset($_POST['is_active'])) {
            $this->params['is_active'] = (int) $_POST['is_active'];
        } else {
            $this->params['is_active'] = '0';
        }
        ///$this->params['language_id'] 	= MicroGrid::GetParameter('language_id');
        ## for images
        if (isset($_POST['image_file'])) {
            $this->params['image_file'] = prepare_input($_POST['image_file']);
        } else {
            if (isset($_FILES['image_file']['name']) && $_FILES['image_file']['name'] != '') {
                // nothing
            } else {
                if (self::GetParameter('action') == 'create') {
                    $this->params['image_file'] = '';
                }
            }
        }
        $this->primaryKey = 'id';
        $this->tableName = TABLE_BANNERS;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=mod_banners_management';
        $this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowTopButtons = true;
        $this->allowLanguages = false;
        $this->languageId = $objLogin->GetPreferredLang();
        $this->WHERE_CLAUSE = '';
        //'WHERE ';
        $this->ORDER_CLAUSE = 'ORDER BY priority_order ASC';
        // ORDER BY date_created DESC
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isFilteringAllowed = false;
        // define filtering fields
        $this->arrFilteringFields = array();
        $arr_is_active = array('0' => '<span class=no>' . _NO . '</span>', '1' => '<span class=yes>' . _YES . '</span>');
        $slideshow_caption_html = ModulesSettings::Get('banners', 'slideshow_caption_html');
        ///////////////////////////////////////////////////////////////////////////////
        // 1. prepare translation fields array
        $this->arrTranslations = $this->PrepareTranslateFields(array('image_text'));
        ///////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////
        // 2. prepare translations array for edit/detail modes
        $sql_translation_description = $this->PrepareTranslateSql(TABLE_BANNERS_DESCRIPTION, 'banner_id', array('image_text'));
        ///////////////////////////////////////////////////////////////////////////////
        //----------------------------------------------------------------------
        // VIEW MODE
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT b.' . $this->primaryKey . ',
									b.image_file,
									b.image_file_thumb,
									bd.image_text as image_text, 
									b.priority_order,
									b.is_active
								FROM (' . $this->tableName . ' b
									LEFT OUTER JOIN ' . TABLE_BANNERS_DESCRIPTION . ' bd ON b.id = bd.banner_id AND bd.language_id = \'' . $this->languageId . '\')';
        // define view mode fields
        $this->arrViewModeFields = array('image_file_thumb' => array('title' => _BANNER_IMAGE, 'type' => 'image', 'sortable' => false, 'align' => 'left', 'width' => '150px', 'image_width' => '120px', 'image_height' => '30px', 'target' => 'images/banners/', 'no_image' => 'no_image.png'), 'image_text' => array('title' => _DESCRIPTION, 'type' => 'label', 'align' => 'left', 'width' => '', 'maxlength' => '70', 'format' => 'strip_tags'), 'priority_order' => array('title' => _ORDER, 'type' => 'label', 'align' => 'center', 'width' => '60px', 'movable' => true), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'align' => 'center', 'width' => '130px', 'sortable' => true, 'nowrap' => '', 'visible' => true, 'source' => $arr_is_active));
        //----------------------------------------------------------------------
        // ADD MODE
        //----------------------------------------------------------------------
        // define add mode fields
        $max_order = self::GetParameter('action') == 'add' ? $this->GetMaxOrder('priority_order', 99) : 0;
        $this->arrAddModeFields = array('separator_general' => array('separator_info' => array('legend' => _GENERAL), 'image_file' => array('title' => _BANNER_IMAGE, 'type' => 'image', 'width' => '210px', 'required' => true, 'readonly' => false, 'target' => 'images/banners/', 'no_image' => '', 'random_name' => 'true', 'unique' => false, 'thumbnail_create' => true, 'thumbnail_field' => 'image_file_thumb', 'thumbnail_width' => '140px', 'thumbnail_height' => '30px', 'file_maxsize' => '1000k'), 'link_url' => array('title' => _URL . ' (http://)', 'type' => 'textbox', 'width' => '270px', 'required' => false, 'readonly' => false, 'validation_type' => 'text', 'maxlength' => '255'), 'priority_order' => array('title' => _ORDER, 'type' => 'textbox', 'width' => '50px', 'required' => true, 'default' => $max_order, 'readonly' => false, 'validation_type' => 'numeric', 'maxlength' => '2'), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'readonly' => false, 'default' => '1', 'true_value' => '1', 'false_value' => '0')));
        //----------------------------------------------------------------------
        // EDIT MODE
        //----------------------------------------------------------------------
        // define edit mode fields
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->primaryKey . ',
								image_file,
								image_file_thumb,
								' . $sql_translation_description . '
								link_url,
								priority_order,
								is_active,
								CONCAT(\'<img src="images/banners/\', image_file_thumb, \'" alt="" width="140px" height="30px" />\') as my_image_file
							FROM ' . $this->tableName . '
							WHERE ' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('separator_general' => array('separator_info' => array('legend' => _GENERAL), 'image_file' => array('title' => _BANNER_IMAGE, 'type' => 'image', 'width' => '210px', 'required' => true, 'readonly' => false, 'target' => 'images/banners/', 'no_image' => '', 'image_width' => '280px', 'image_height' => '90px', 'random_name' => 'true', 'unique' => false, 'thumbnail_create' => true, 'thumbnail_field' => 'image_file_thumb', 'thumbnail_width' => '140px', 'thumbnail_height' => '30px'), 'link_url' => array('title' => _URL . ' (http://)', 'type' => 'textbox', 'width' => '270px', 'required' => false, 'readonly' => false, 'validation_type' => 'text', 'maxlength' => '255'), 'priority_order' => array('title' => _ORDER, 'type' => 'textbox', 'width' => '50px', 'required' => true, 'readonly' => false, 'validation_type' => 'numeric', 'maxlength' => '2'), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'readonly' => false, 'true_value' => '1', 'false_value' => '0')));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('separator_general' => array('separator_info' => array('legend' => _GENERAL), 'image_file' => array('title' => _BANNER_IMAGE, 'type' => 'image', 'target' => 'images/banners/', 'image_width' => '280px', 'image_height' => '90px', 'no_image' => 'no_image.png', 'file_maxsize' => '1000k'), 'link_url' => array('title' => _URL, 'type' => 'label'), 'priority_order' => array('title' => _ORDER, 'type' => 'label'), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'source' => $arr_is_active)));
        ///////////////////////////////////////////////////////////////////////////////
        // 3. add translation fields to all modes
        $this->AddTranslateToModes($this->arrTranslations, array('image_text' => array('title' => _DESCRIPTION, 'type' => 'textarea', 'width' => '410px', 'height' => '90px', 'required' => false, 'maxlength' => '255', 'validation_maxlength' => '255', 'readonly' => false, 'post_html' => $slideshow_caption_html == 'yes' ? '<br>' . _CAN_USE_TAGS_MSG . ' &lt;b&gt;, &lt;i&gt;, &lt;u&gt;, &lt;br&gt;' : '')));
        ///////////////////////////////////////////////////////////////////////////////
    }
コード例 #11
0
ファイル: News.class.php プロジェクト: mozdial/Directory
    function __construct()
    {
        parent::__construct();
        global $objSettings;
        $this->params = array();
        if (isset($_POST['news_code'])) {
            $this->params['news_code'] = prepare_input($_POST['news_code']);
        }
        if (isset($_POST['header_text'])) {
            $this->params['header_text'] = prepare_input($_POST['header_text']);
        }
        if (isset($_POST['body_text'])) {
            $this->params['body_text'] = prepare_input($_POST['body_text'], false, 'medium');
        }
        if (isset($_POST['type'])) {
            $this->params['type'] = prepare_input($_POST['type']);
        }
        if (isset($_POST['date_created'])) {
            $this->params['date_created'] = prepare_input($_POST['date_created']);
        }
        $this->params['language_id'] = MicroGrid::GetParameter('language_id');
        $this->isHtmlEncoding = true;
        $this->primaryKey = 'id';
        $this->tableName = TABLE_NEWS;
        $this->dataSet = array();
        $this->error = '';
        $this->languageId = $this->params['language_id'] != '' ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->formActionURL = 'index.php?admin=mod_news_management';
        $this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowLanguages = true;
        $this->WHERE_CLAUSE = 'WHERE language_id = \'' . $this->languageId . '\'';
        $this->ORDER_CLAUSE = 'ORDER BY date_created DESC';
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        // prepare languages array
        $total_languages = Languages::GetAllActive();
        $arr_languages = array();
        foreach ($total_languages[0] as $key => $val) {
            $arr_languages[$val['abbreviation']] = $val['lang_name'];
        }
        $arr_types = array('news' => _NEWS, 'events' => _EVENTS);
        $datetime_format = get_datetime_format();
        if ($objSettings->GetParameter('date_format') == 'mm/dd/yyyy') {
            $this->sqlFieldDatetimeFormat = '%b %d, %Y %H:%i';
            $this->sqlFieldDateFormat = '%b %d, %Y';
        } else {
            $this->sqlFieldDatetimeFormat = '%d %b, %Y %H:%i';
            $this->sqlFieldDateFormat = '%d %b, %Y';
        }
        $this->SetLocale(Application::Get('lc_time_name'));
        //----------------------------------------------------------------------
        // VIEW MODE
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
									type,
									header_text,
									body_text,
									DATE_FORMAT(' . $this->tableName . '.date_created, \'' . $this->sqlFieldDatetimeFormat . '\') as mod_date_created,
									CASE
										WHEN type = "events" THEN
											CONCAT("<a href=javascript:void(0) onclick=javascript:__mgDoPostBack(\'' . $this->tableName . '\',\'details\',\'", ' . $this->primaryKey . ', "\')>events",
											       " (", (SELECT COUNT(*) as cnt FROM ' . TABLE_EVENTS_REGISTERED . ' er WHERE er.event_id = ' . $this->tableName . '.' . $this->primaryKey . '), ")</a>")
										ELSE type										
									END as type_link
								FROM ' . $this->tableName;
        // define view mode fields
        $this->arrViewModeFields = array('mod_date_created' => array('title' => _DATE_CREATED, 'type' => 'label', 'align' => 'left', 'width' => '190px', 'format' => 'date', 'format_parameter' => $datetime_format), 'header_text' => array('title' => _HEADER, 'type' => 'label', 'align' => 'left', 'width' => '', 'nowrap' => 'wrap', 'maxlength' => '90'), 'type_link' => array('title' => _TYPE, 'type' => 'label', 'align' => 'center', 'width' => '9%'));
        //----------------------------------------------------------------------
        // ADD MODE
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array('header_text' => array('title' => _HEADER, 'type' => 'textbox', 'required' => true, 'width' => '410px', 'maxlength' => '255'), 'body_text' => array('title' => _TEXT, 'type' => 'textarea', 'width' => '490px', 'height' => '200px', 'editor_type' => 'wysiwyg', 'readonly' => false, 'default' => '', 'required' => true, 'validation_type' => '', 'unique' => false, 'maxlength' => '4096', 'validation_maxlength' => '4096'), 'type' => array('title' => _TYPE, 'type' => 'enum', 'source' => $arr_types, 'required' => true, 'default' => 'news'), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'datetime', 'required' => true, 'readonly' => false, 'default' => @date('Y-m-d H:i:s'), 'validation_type' => '', 'unique' => false, 'visible' => true, 'format' => 'date', 'format_parameter' => $datetime_format, 'min_year' => '10', 'max_year' => '5'), 'language_id' => array('title' => _LANGUAGE, 'type' => 'enum', 'source' => $arr_languages, 'required' => true), 'news_code' => array('title' => '', 'type' => 'hidden', 'required' => true, 'readonly' => false, 'default' => get_random_string(10)));
        //----------------------------------------------------------------------
        // EDIT MODE
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.type,
								' . $this->tableName . '.header_text,
								' . $this->tableName . '.body_text,
								' . $this->tableName . '.language_id,
								' . $this->tableName . '.date_created,
								DATE_FORMAT(' . $this->tableName . '.date_created, \'' . $this->sqlFieldDatetimeFormat . '\') as mod_date_created,
								' . TABLE_LANGUAGES . '.lang_name as language_name 
							FROM ' . $this->tableName . '
								INNER JOIN ' . TABLE_LANGUAGES . ' ON ' . $this->tableName . '.language_id = ' . TABLE_LANGUAGES . '.abbreviation
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('header_text' => array('title' => _HEADER, 'type' => 'textbox', 'required' => true, 'width' => '410px', 'maxlength' => '255'), 'body_text' => array('title' => _TEXT, 'type' => 'textarea', 'width' => '490px', 'height' => '200px', 'editor_type' => 'wysiwyg', 'readonly' => false, 'default' => '', 'required' => true, 'validation_type' => '', 'unique' => false, 'maxlength' => '4096', 'validation_maxlength' => '4096'), 'type' => array('title' => _TYPE, 'type' => 'enum', 'source' => $arr_types, 'required' => true), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'datetime', 'required' => true, 'readonly' => false, 'unique' => false, 'visible' => true, 'format' => 'date', 'format_parameter' => $datetime_format, 'min_year' => '10', 'max_year' => '5'), 'language_id' => array('title' => _LANGUAGE, 'type' => 'enum', 'source' => $arr_languages, 'required' => true, 'readonly' => true));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('header_text' => array('title' => _HEADER, 'type' => 'label'), 'body_text' => array('title' => _TEXT, 'type' => 'html'), 'type' => array('title' => _TYPE, 'type' => 'label'), 'mod_date_created' => array('title' => _DATE_CREATED, 'type' => 'label'), 'language_name' => array('title' => _LANGUAGE, 'type' => 'label'));
    }
コード例 #12
0
ファイル: Comments.class.php プロジェクト: mozdial/Directory
    function __construct($page_id = '')
    {
        parent::__construct();
        global $objSettings;
        $this->params = array();
        ## for standard fields
        if (isset($_POST['is_published'])) {
            $this->params['is_published'] = prepare_input($_POST['is_published']);
        }
        if (isset($_POST['date_published'])) {
            $this->params['date_published'] = prepare_input($_POST['date_published']);
        }
        if ($page_id == 'home') {
            $page_id = '';
        }
        ## for checkboxes
        //$this->params['parameter4'] = isset($_POST['parameter4']) ? $_POST['parameter4'] : '0';
        ## for images
        //if(isset($_POST['icon'])){
        //	$this->params['icon'] = $_POST['icon'];
        //}else if(isset($_FILES['icon']['name']) && $_FILES['icon']['name'] != ''){
        //	// nothing
        //}else if (self::GetParameter('action') == 'create'){
        //	$this->params['icon'] = '';
        //}
        $this->params['language_id'] = MicroGrid::GetParameter('language_id');
        //$this->uPrefix 		= 'prefix_';
        $this->primaryKey = 'id';
        $this->tableName = TABLE_COMMENTS;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=mod_comments_management' . ($page_id != '' ? '&pid=' . (int) $page_id : '');
        $this->actions = array('add' => false, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowLanguages = false;
        $this->languageId = $this->params['language_id'] != '' ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = $page_id != '' ? 'WHERE ' . $this->tableName . '.article_id=' . $page_id : '';
        $this->ORDER_CLAUSE = 'ORDER BY ' . $this->tableName . '.is_published ASC, ' . $this->tableName . '.date_created DESC';
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isFilteringAllowed = true;
        // define filtering fields
        $this->arrFilteringFields = array(_PUBLISHED => array('table' => $this->tableName, 'field' => 'is_published', 'type' => 'dropdownlist', 'source' => array('0' => _NO, '1' => _YES), 'sign' => '=', 'width' => '90px'));
        $datetime_format = get_datetime_format();
        $arr_is_published = array('0' => '<span class=no>' . _NO . '</span>', '1' => '<span class=yes>' . _YES . '</span>');
        if ($objSettings->GetParameter('date_format') == 'mm/dd/yyyy') {
            $this->sqlFieldDatetimeFormat = '%b %d, %Y %H:%i';
            $this->sqlFieldDateFormat = '%b %d, %Y';
        } else {
            $this->sqlFieldDatetimeFormat = '%d %b, %Y %H:%i';
            $this->sqlFieldDateFormat = '%d %b, %Y';
        }
        $this->SetLocale(Application::Get('lc_time_name'));
        //----------------------------------------------------------------------
        // VIEW MODE
        // format: strip_tags
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->tableName . '.' . $this->primaryKey . ',
									' . $this->tableName . '.article_id,
									' . $this->tableName . '.user_id,
									' . $this->tableName . '.user_name,
									' . $this->tableName . '.user_email,
									' . $this->tableName . '.comment_text,									
									DATE_FORMAT(' . $this->tableName . '.date_created, \'' . $this->sqlFieldDatetimeFormat . '\') as mod_date_created,
									CONCAT("<img src=\\"images/", IF(' . $this->tableName . '.is_published, "published_g.gif", "published_x.gif"), "\\" alt=\\"\\" />") as is_published,
									' . TABLE_PAGES . '.page_title,
									' . TABLE_LANGUAGES . '.lang_name
								FROM ' . $this->tableName . '
									LEFT OUTER JOIN ' . TABLE_PAGES . ' ON ' . $this->tableName . '.article_id = ' . TABLE_PAGES . '.id
									LEFT OUTER JOIN ' . TABLE_LANGUAGES . ' ON ' . TABLE_PAGES . '.language_id = ' . TABLE_LANGUAGES . '.abbreviation
								';
        // define view mode fields
        $this->arrViewModeFields = array('mod_date_created' => array('title' => _DATE_CREATED, 'type' => 'label', 'align' => 'left', 'width' => '160px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'height' => '', 'maxlength' => ''), 'page_title' => array('title' => _ARTICLE, 'type' => 'label', 'align' => 'left', 'width' => '', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'height' => '', 'maxlength' => '', 'format' => ''), 'is_published' => array('title' => _PUBLISHED, 'type' => 'label', 'align' => 'center', 'width' => '80px'), 'lang_name' => array('title' => _LANGUAGE, 'type' => 'label', 'align' => 'center', 'width' => '90px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'height' => '', 'maxlength' => '', 'format' => ''), 'user_email' => array('title' => _EMAIL_ADDRESS, 'type' => 'label', 'align' => 'center', 'width' => '130px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'height' => '', 'maxlength' => '32', 'format' => ''), 'user_name' => array('title' => _USERNAME, 'type' => 'label', 'align' => 'center', 'width' => '', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'height' => '', 'maxlength' => '32', 'format' => ''));
        //----------------------------------------------------------------------
        // ADD MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address
        // 	 Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255 ....
        //   Ex.: 'validation_maxlength'=>'255'
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array();
        //----------------------------------------------------------------------
        // EDIT MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address
        //   Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255 ....
        //   Ex.: 'validation_maxlength'=>'255'
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.article_id,
								' . $this->tableName . '.user_id,
								' . $this->tableName . '.user_name,
								' . $this->tableName . '.user_email,
								' . $this->tableName . '.comment_text,
								' . $this->tableName . '.is_published,
								DATE_FORMAT(' . $this->tableName . '.date_created, \'' . $this->sqlFieldDatetimeFormat . '\') as date_created,
								' . $this->tableName . '.date_published,
								IF(' . $this->tableName . '.date_published = "0000-00-00 00:00:00", "", DATE_FORMAT(' . $this->tableName . '.date_published, \'' . $this->sqlFieldDatetimeFormat . '\')) as m_date_published,
								' . TABLE_PAGES . '.page_title,
								' . TABLE_LANGUAGES . '.lang_name
							FROM ' . $this->tableName . '
								LEFT OUTER JOIN ' . TABLE_PAGES . ' ON ' . $this->tableName . '.article_id = ' . TABLE_PAGES . '.id
								LEFT OUTER JOIN ' . TABLE_LANGUAGES . ' ON ' . TABLE_PAGES . '.language_id = ' . TABLE_LANGUAGES . '.abbreviation
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('page_title' => array('title' => _ARTICLE, 'type' => 'label'), 'user_name' => array('title' => _USERNAME, 'type' => 'label'), 'user_email' => array('title' => _EMAIL_ADDRESS, 'type' => 'label'), 'lang_name' => array('title' => _LANGUAGE, 'type' => 'label'), 'comment_text' => array('title' => _TEXT, 'type' => 'label'), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'date_published' => array('title' => '', 'type' => 'hidden', 'required' => false, 'default' => date('Y-m-d H:i:s')), 'm_date_published' => array('title' => _DATE_PUBLISHED, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'is_published' => array('title' => _APPROVE, 'type' => 'enum', 'width' => '80px', 'required' => true, 'readonly' => false, 'source' => array('1' => _YES), 'unique' => false));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('page_title' => array('title' => _ARTICLE, 'type' => 'label'), 'user_name' => array('title' => _USERNAME, 'type' => 'label'), 'user_email' => array('title' => _EMAIL_ADDRESS, 'type' => 'label'), 'lang_name' => array('title' => _LANGUAGE, 'type' => 'label'), 'comment_text' => array('title' => _TEXT, 'type' => 'label', 'format' => 'nl2br'), 'is_published' => array('title' => _APPROVED, 'type' => 'enum', 'source' => $arr_is_published), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'm_date_published' => array('title' => _DATE_PUBLISHED, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format));
    }
コード例 #13
0
    function __construct()
    {
        parent::__construct();
        global $objLogin;
        $this->params = array();
        ## for standard fields
        if (isset($_POST['name'])) {
            $this->params['name'] = prepare_input($_POST['name']);
        }
        if (isset($_POST['description'])) {
            $this->params['description'] = prepare_input($_POST['description']);
        }
        ## for checkboxes
        //$this->params['field4'] = isset($_POST['field4']) ? prepare_input($_POST['field4']) : '0';
        ## for images (not necessary)
        //if(isset($_POST['icon'])){
        //	$this->params['icon'] = prepare_input($_POST['icon']);
        //}else if(isset($_FILES['icon']['name']) && $_FILES['icon']['name'] != ''){
        //	// nothing
        //}else if (self::GetParameter('action') == 'create'){
        //	$this->params['icon'] = '';
        //}
        ## for files:
        // define nothing
        //$this->params['language_id'] = MicroGrid::GetParameter('language_id');
        //$this->uPrefix 		= 'prefix_';
        $this->primaryKey = 'id';
        $this->tableName = TABLE_CUSTOMER_GROUPS;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=mod_customers_groups';
        $allow_adding = true;
        $allow_editing = true;
        $allow_deleting = true;
        if (self::$PROJECT == 'HotelSite' && $objLogin->IsLoggedInAs('hotelowner')) {
            $allow_adding = $allow_editing = $allow_deleting = false;
        }
        $this->actions = array('add' => $allow_adding, 'edit' => $allow_editing, 'details' => true, 'delete' => $allow_deleting);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowLanguages = false;
        $this->languageId = '';
        //($this->params['language_id'] != '') ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = '';
        // WHERE .... / 'WHERE language_id = \''.$this->languageId.'\'';
        $this->ORDER_CLAUSE = '';
        // ORDER BY '.$this->tableName.'.date_created DESC
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isFilteringAllowed = false;
        // define filtering fields
        $this->arrFilteringFields = array();
        // prepare languages array
        /// $total_languages = Languages::GetAllActive();
        /// $arr_languages      = array();
        /// foreach($total_languages[0] as $key => $val){
        /// 	$arr_languages[$val['abbreviation']] = $val['lang_name'];
        /// }
        //----------------------------------------------------------------------
        // VIEW MODE
        // format: strip_tags
        // format: nl2br
        // format: 'format'=>'date', 'format_parameter'=>'M d, Y, g:i A' + IF(date_created = '0000-00-00 00:00:00', '', date_created) as date_created,
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
									name,
									description
								FROM ' . $this->tableName;
        // define view mode fields
        $this->arrViewModeFields = array('name' => array('title' => _GROUP_NAME, 'type' => 'label', 'align' => 'left', 'width' => '140px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'tooltip' => '', 'maxlength' => '', 'format' => '', 'format_parameter' => ''), 'description' => array('title' => _DESCRIPTION, 'type' => 'label', 'align' => 'left', 'width' => '', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'tooltip' => true, 'maxlength' => '70', 'format' => '', 'format_parameter' => ''), 'id' => array('title' => 'ID', 'type' => 'label', 'align' => 'center', 'width' => '70px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'tooltip' => '', 'maxlength' => '', 'format' => '', 'format_parameter' => ''));
        //----------------------------------------------------------------------
        // ADD MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address|password
        // 	 Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255... Ex.: 'validation_maxlength'=>'255'
        // - Validation Max Value: 12, 255... Ex.: 'validation_maximum'=>'99.99'
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array('name' => array('title' => _GROUP_NAME, 'type' => 'textbox', 'width' => '210px', 'readonly' => false, 'maxlength' => '32', 'default' => '', 'required' => true, 'validation_type' => '', 'unique' => true, 'visible' => true), 'description' => array('title' => _DESCRIPTION, 'type' => 'textarea', 'width' => '310px', 'height' => '90px', 'editor_type' => 'simple', 'readonly' => false, 'default' => '', 'required' => false, 'validation_type' => '', 'maxlength' => '255', 'validation_maxlength' => '255', 'unique' => false));
        //----------------------------------------------------------------------
        // EDIT MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address|password
        //   Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255... Ex.: 'validation_maxlength'=>'255'
        // - Validation Max Value: 12, 255... Ex.: 'validation_maximum'=>'99.99'
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.name,
								' . $this->tableName . '.description
							FROM ' . $this->tableName . '
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('name' => array('title' => _GROUP_NAME, 'type' => 'textbox', 'width' => '210px', 'readonly' => false, 'maxlength' => '32', 'default' => '', 'required' => true, 'validation_type' => '', 'unique' => true, 'visible' => true), 'description' => array('title' => _DESCRIPTION, 'type' => 'textarea', 'width' => '310px', 'height' => '90px', 'editor_type' => 'simple', 'readonly' => false, 'default' => '', 'required' => false, 'validation_type' => '', 'maxlength' => '255', 'validation_maxlength' => '255', 'unique' => false));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('name' => array('title' => _GROUP_NAME, 'type' => 'label'), 'description' => array('title' => _DESCRIPTION, 'type' => 'label'));
    }
コード例 #14
0
ファイル: Roles.class.php プロジェクト: mozdial/Directory
    function __construct()
    {
        parent::__construct();
        $this->params = array();
        ## for standard fields
        if (isset($_POST['name'])) {
            $this->params['name'] = prepare_input($_POST['name']);
        }
        if (isset($_POST['description'])) {
            $this->params['description'] = prepare_input($_POST['description']);
        }
        ## for checkboxes
        //$this->params['field4'] = isset($_POST['field4']) ? prepare_input($_POST['field4']) : '0';
        ## for images (not necessary)
        //if(isset($_POST['icon'])){
        //	$this->params['icon'] = prepare_input($_POST['icon']);
        //}else if(isset($_FILES['icon']['name']) && $_FILES['icon']['name'] != ''){
        //	// nothing
        //}else if (self::GetParameter('action') == 'create'){
        //	$this->params['icon'] = '';
        //}
        ## for files:
        // define nothing
        $this->params['language_id'] = MicroGrid::GetParameter('language_id');
        //$this->uPrefix 		= 'prefix_';
        $this->primaryKey = 'id';
        $this->tableName = TABLE_ROLES;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=roles_management';
        $this->actions = array('add' => false, 'edit' => true, 'details' => true, 'delete' => false);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowTopButtons = false;
        $this->alertOnDelete = '';
        // leave empty to use default alerts
        $this->allowLanguages = false;
        $this->languageId = '';
        //($this->params['language_id'] != '') ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = '';
        // WHERE .... / 'WHERE language_id = \''.$this->languageId.'\'';
        $this->ORDER_CLAUSE = '';
        // ORDER BY '.$this->tableName.'.date_created DESC
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isExportingAllowed = false;
        $this->arrExportingTypes = array('csv' => false);
        $this->isFilteringAllowed = false;
        // define filtering fields
        $this->arrFilteringFields = array();
        ///$date_format = get_date_format('view');
        ///$date_format_edit = get_date_format('edit');
        ///$currency_format = get_currency_format();
        // prepare languages array
        /// $total_languages = Languages::GetAllActive();
        /// $arr_languages      = array();
        /// foreach($total_languages[0] as $key => $val){
        /// 	$arr_languages[$val['abbreviation']] = $val['lang_name'];
        /// }
        //----------------------------------------------------------------------
        // VIEW MODE
        // format: strip_tags
        // format: nl2br
        // format: 'format'=>'date', 'format_parameter'=>'M d, Y, g:i A'
        // format: 'format'=>'currency', 'format_parameter'=>'european|2' or 'format_parameter'=>'american|4'
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
									name,
									description,
									"[ ' . _PRIVILEGES . ' ]" as link_privileges
								FROM ' . $this->tableName;
        // define view mode fields
        $this->arrViewModeFields = array('name' => array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => '20%', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'tooltip' => '', 'maxlength' => '32', 'format' => '', 'format_parameter' => ''), 'description' => array('title' => _DESCRIPTION, 'type' => 'label', 'align' => 'left', 'width' => '', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'tooltip' => '', 'maxlength' => '100', 'format' => '', 'format_parameter' => ''), 'link_privileges' => array('title' => '', 'type' => 'link', 'align' => 'left', 'width' => '90px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'tooltip' => '', 'maxlength' => '', 'format' => '', 'format_parameter' => '', 'href' => 'index.php?admin=role_privileges_management&role_id={id}', 'target' => ''));
        //----------------------------------------------------------------------
        // ADD MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address|password|date
        // 	 Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255... Ex.: 'validation_maxlength'=>'255'
        // - Validation Min Length: 4, 6... Ex.: 'validation_minlength'=>'4'
        // - Validation Max Value: 12, 255... Ex.: 'validation_maximum'=>'99.99'
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array('name' => array('title' => _NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'maxlength' => '50', 'default' => '', 'validation_type' => 'text', 'unique' => true, 'visible' => true), 'description' => array('title' => _DESCRIPTION, 'type' => 'textarea', 'width' => '310px', 'required' => false, 'height' => '90px', 'editor_type' => 'simple', 'readonly' => false, 'default' => '', 'validation_type' => 'text', 'maxlength' => '255', 'validation_maxlength' => '255', 'unique' => false));
        //----------------------------------------------------------------------
        // EDIT MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address|password|date
        //   Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255... Ex.: 'validation_maxlength'=>'255'
        // - Validation Min Length: 4, 6... Ex.: 'validation_minlength'=>'4'
        // - Validation Max Value: 12, 255... Ex.: 'validation_maximum'=>'99.99'
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.name,
								' . $this->tableName . '.description
							FROM ' . $this->tableName . '
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('name' => array('title' => _NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'maxlength' => '50', 'default' => '', 'validation_type' => 'text', 'unique' => true, 'visible' => true), 'description' => array('title' => _DESCRIPTION, 'type' => 'textarea', 'width' => '310px', 'required' => false, 'height' => '90px', 'editor_type' => 'simple', 'readonly' => false, 'default' => '', 'validation_type' => 'text', 'maxlength' => '255', 'validation_maxlength' => '255', 'unique' => false));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('name' => array('title' => _NAME, 'type' => 'label'), 'description' => array('title' => _DESCRIPTION, 'type' => 'label'));
    }
コード例 #15
0
ファイル: BanList.class.php プロジェクト: mozdial/Directory
    function __construct()
    {
        parent::__construct();
        $this->params = array();
        ## for standard fields
        if (isset($_POST['ban_item'])) {
            $this->params['ban_item'] = prepare_input($_POST['ban_item']);
        }
        if (isset($_POST['ban_reason'])) {
            $this->params['ban_reason'] = prepare_input($_POST['ban_reason']);
        }
        $item_validation_type = '';
        if (isset($_POST['ban_item_type'])) {
            $this->params['ban_item_type'] = prepare_input($_POST['ban_item_type']);
            if ($this->params['ban_item_type'] == 'IP') {
                $item_validation_type = 'ip_address';
            } else {
                if ($this->params['ban_item_type'] == 'Email') {
                    $item_validation_type = 'email';
                }
            }
        }
        ## for checkboxes
        //if(isset($_POST['parameter4']))   $this->params['parameter4'] = $_POST['parameter4']; else $this->params['parameter4'] = '0';
        ## for images
        //if(isset($_POST['icon'])){
        //	$this->params['icon'] = $_POST['icon'];
        //}else if(isset($_FILES['icon']['name']) && $_FILES['icon']['name'] != ''){
        //	// nothing
        //}else if (self::GetParameter('action') == 'create'){
        //	$this->params['icon'] = '';
        //}
        $this->params['language_id'] = MicroGrid::GetParameter('language_id');
        $this->primaryKey = 'id';
        $this->tableName = TABLE_BANLIST;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=ban_list';
        $this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowLanguages = false;
        $this->languageId = $this->params['language_id'] != '' ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = '';
        // WHERE .... / 'WHERE language_id = \''.$this->languageId.'\'';
        $this->ORDER_CLAUSE = '';
        // ORDER BY '.$this->tableName.'.date_created DESC
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isFilteringAllowed = true;
        $arr_ban_types = array('IP' => _IP_ADDRESS, 'Email' => _EMAIL_ADDRESS);
        // define filtering fields
        $this->arrFilteringFields = array(_TYPE => array('table' => $this->tableName, 'field' => 'ban_item_type', 'type' => 'dropdownlist', 'source' => $arr_ban_types, 'sign' => '=', 'width' => '130px'));
        // prepare languages array
        /// $total_languages = Languages::GetAllActive();
        /// $arr_languages      = array();
        /// foreach($total_languages[0] as $key => $val){
        /// 	$arr_languages[$val['abbreviation']] = $val['lang_name'];
        /// }
        //----------------------------------------------------------------------
        // VIEW MODE
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
									ban_item,
									CASE
										WHEN ban_item_type = \'IP\' THEN \'' . _IP_ADDRESS . '\'
										WHEN ban_item_type = \'Email\' THEN \'' . _EMAIL_ADDRESS . '\'
										ELSE \'' . _UNKNOWN . '\'
									END ban_item_type,
									ban_reason
								FROM ' . $this->tableName;
        // define view mode fields
        $this->arrViewModeFields = array('ban_item' => array('title' => _BAN_ITEM, 'type' => 'label', 'align' => 'left', 'width' => '170px', 'height' => '', 'maxlength' => ''), 'ban_item_type' => array('title' => _TYPE, 'type' => 'label', 'align' => 'left', 'width' => '150px', 'height' => '', 'maxlength' => ''), 'ban_reason' => array('title' => _REASON, 'type' => 'label', 'align' => 'left', 'width' => '', 'height' => '', 'maxlength' => ''));
        //----------------------------------------------------------------------
        // ADD MODE
        // Validation Type: alpha|numeric|float|alpha_numeric|text|email
        // Validation Sub-Type: positive (for numeric and float)
        // Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array('ban_item' => array('title' => _BAN_ITEM, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'unique' => true, 'maxlength' => '70', 'default' => '', 'validation_type' => $item_validation_type), 'ban_item_type' => array('title' => _TYPE, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '130px', 'source' => $arr_ban_types), 'ban_reason' => array('title' => _REASON, 'type' => 'textarea', 'width' => '310px', 'height' => '90px', 'required' => false, 'maxlength' => '255', 'validation_maxlength' => '255', 'readonly' => false, 'default' => 'Spam from this IP/Email', 'validation_type' => ''));
        //----------------------------------------------------------------------
        // EDIT MODE
        // Validation Type: alpha|numeric|float|alpha_numeric|text|email
        // Validation Sub-Type: positive (for numeric and float)
        // Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.ban_item,
								' . $this->tableName . '.ban_item_type,
								' . $this->tableName . '.ban_reason
							FROM ' . $this->tableName . '
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('ban_item' => array('title' => _BAN_ITEM, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'unique' => true, 'maxlength' => '70', 'default' => '', 'validation_type' => $item_validation_type), 'ban_item_type' => array('title' => _TYPE, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '130px', 'source' => $arr_ban_types), 'ban_reason' => array('title' => _REASON, 'type' => 'textarea', 'width' => '310px', 'height' => '90px', 'required' => false, 'maxlength' => '255', 'validation_maxlength' => '255', 'readonly' => false, 'default' => 'Spam from this IP/Email', 'validation_type' => ''));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('ban_item' => array('title' => _BAN_ITEM, 'type' => 'label'), 'ban_item_type' => array('title' => _TYPE, 'type' => 'label'), 'ban_reason' => array('title' => _REASON, 'type' => 'label'));
    }
コード例 #16
0
    function __construct()
    {
        parent::__construct();
        global $objLogin;
        $album = MicroGrid::GetParameter('album', false);
        $objAlbums = new GalleryAlbums();
        $album_info = $objAlbums->GetAlbumInfo($album);
        $this->params = array();
        if (isset($_POST['album_code'])) {
            $this->params['album_code'] = prepare_input($_POST['album_code']);
        }
        if (isset($_POST['priority_order'])) {
            $this->params['priority_order'] = prepare_input($_POST['priority_order']);
        }
        if (isset($_POST['is_active'])) {
            $this->params['is_active'] = prepare_input($_POST['is_active']);
        } else {
            $this->params['is_active'] = '0';
        }
        if ($album_info[0]['album_type'] == 'video') {
            if (isset($_POST['item_file'])) {
                $this->params['item_file'] = prepare_input($_POST['item_file']);
                if ($this->params['item_file'] != '' && !preg_match('/^http:\\/\\/i/', $this->params['item_file'])) {
                    $this->params['item_file'] = 'http://' . $this->params['item_file'];
                }
            }
            if (isset($_POST['item_file_thumb'])) {
                $this->params['item_file_thumb'] = prepare_input($_POST['item_file_thumb'], false, 'medium');
            }
        }
        ///$this->params['language_id'] 	= MicroGrid::GetParameter('language_id');
        $icon_width = ModulesSettings::Get('gallery', 'album_icon_width') != '' ? ModulesSettings::Get('gallery', 'album_icon_width') : '120px';
        $icon_height = ModulesSettings::Get('gallery', 'album_icon_height') != '' ? ModulesSettings::Get('gallery', 'album_icon_height') : '90px';
        $this->primaryKey = 'id';
        $this->tableName = TABLE_GALLERY_ALBUM_ITEMS;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=mod_gallery_upload_items&album=' . $album;
        $this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowTopButtons = true;
        $this->allowLanguages = false;
        $this->languageId = $objLogin->GetPreferredLang();
        $this->WHERE_CLAUSE = 'WHERE album_code = \'' . $album . '\'';
        $this->ORDER_CLAUSE = 'ORDER BY priority_order ASC';
        // ORDER BY date_created DESC
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isFilteringAllowed = false;
        // define filtering fields
        $this->arrFilteringFields = array();
        ///////////////////////////////////////////////////////////////////////////////
        // 1. prepare translation fields array
        $this->arrTranslations = $this->PrepareTranslateFields(array('name', 'description'));
        ///////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////
        // 2. prepare translations array for edit/detail modes
        $sql_translation_description = $this->PrepareTranslateSql(TABLE_GALLERY_ALBUM_ITEMS_DESCRIPTION, 'gallery_album_item_id', array('name', 'description'));
        ///////////////////////////////////////////////////////////////////////////////
        $arr_is_active = array('0' => '<span class=no>' . _NO . '</span>', '1' => '<span class=yes>' . _YES . '</span>');
        $help_tooltip = '<br><img src=\'' . APPHP_BASE . 'images/question_mark.png\' alt=\'\' /> Ex.: http://www.youtube.com/watch?v=5VIV8nt2KkU - or - http://localhost/{your site}/my_video.wmv';
        //----------------------------------------------------------------------
        // VIEW MODE
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT
									gi.' . $this->primaryKey . ',
									gi.album_code,
									gi.item_file,
									gi.item_file_thumb,
									gi.priority_order,
									gi.is_active,
									gid.name,
									gid.description
								FROM (' . $this->tableName . ' gi	
									LEFT OUTER JOIN ' . TABLE_GALLERY_ALBUM_ITEMS_DESCRIPTION . ' gid ON gi.id = gid.gallery_album_item_id AND gid.language_id = \'' . $this->languageId . '\')';
        // define view mode fields
        if ($album_info[0]['album_type'] == 'video') {
            $this->arrViewModeFields['name'] = array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => '20%', 'maxlength' => '30');
            $this->arrViewModeFields['item_file'] = array('title' => _VIDEO, 'type' => 'label', 'align' => 'left', 'width' => '40%');
        } else {
            $this->arrViewModeFields['item_file_thumb'] = array('title' => _IMAGE, 'type' => 'image', 'align' => 'left', 'width' => '60px', 'sortable' => false, 'nowrap' => '', 'visible' => '', 'image_width' => '50px', 'image_height' => '30px', 'target' => 'images/gallery/', 'no_image' => 'no_image.png');
            $this->arrViewModeFields['name'] = array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => '20%', 'maxlength' => '30');
        }
        $this->arrViewModeFields['description'] = array('title' => _DESCRIPTION, 'type' => 'label', 'align' => 'left', 'width' => '', 'maxlength' => '60');
        $this->arrViewModeFields['priority_order'] = array('title' => _ORDER, 'type' => 'label', 'align' => 'center', 'width' => '10%', 'movable' => true);
        $this->arrViewModeFields['is_active'] = array('title' => _ACTIVE, 'type' => 'enum', 'align' => 'center', 'width' => '10%', 'sortable' => true, 'nowrap' => '', 'visible' => true, 'source' => $arr_is_active);
        //----------------------------------------------------------------------
        // ADD MODE
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array('separator_general' => array('separator_info' => array('legend' => _GENERAL), 'priority_order' => array('title' => _ORDER, 'type' => 'textbox', 'width' => '60px', 'maxlength' => '3', 'required' => true, 'readonly' => false, 'validation_type' => 'numeric'), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'readonly' => false, 'default' => '1', 'true_value' => '1', 'false_value' => '0'), 'album_code' => array('title' => '', 'type' => 'hidden', 'required' => true, 'readonly' => false, 'default' => $album)));
        if ($album_info[0]['album_type'] == 'video') {
            $this->arrAddModeFields['separator_general']['item_file'] = array('title' => _VIDEO . ' (http://)', 'type' => 'textbox', 'width' => '370px', 'maxlength' => '255', 'required' => false, 'readonly' => false, 'validation_type' => '', 'post_html' => $help_tooltip);
            $this->arrAddModeFields['separator_general']['item_file_thumb'] = array('title' => _THUMBNAIL . ' (http://)', 'type' => 'textbox', 'width' => '370px', 'maxlength' => '255', 'required' => false, 'readonly' => false, 'validation_type' => '');
        } else {
            $this->arrAddModeFields['separator_general']['item_file'] = array('title' => _IMAGE, 'type' => 'image', 'width' => '210px', 'required' => true, 'readonly' => false, 'target' => 'images/gallery/', 'thumbnail_create' => true, 'thumbnail_field' => 'item_file_thumb', 'thumbnail_width' => $icon_width, 'thumbnail_height' => $icon_height, 'file_maxsize' => '900k');
        }
        //----------------------------------------------------------------------
        // EDIT MODE
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->primaryKey . ',
								album_code,
								item_file,
								item_file_thumb,
								priority_order,
								' . $sql_translation_description . '
								is_active
							FROM ' . $this->tableName . '
							WHERE ' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('separator_general' => array('separator_info' => array('legend' => _GENERAL), 'priority_order' => array('title' => _ORDER, 'type' => 'textbox', 'width' => '60px', 'maxlength' => '3', 'required' => true, 'readonly' => false, 'validation_type' => 'numeric'), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'readonly' => false, 'true_value' => '1', 'false_value' => '0'), 'album_code' => array('title' => '', 'type' => 'hidden', 'required' => true, 'readonly' => false, 'default' => $album)));
        if ($album_info[0]['album_type'] == 'video') {
            $this->arrEditModeFields['separator_general']['item_file'] = array('title' => _VIDEO . ' (http://) ', 'type' => 'textbox', 'width' => '370px', 'maxlength' => '255', 'required' => false, 'readonly' => false, 'validation_type' => '', 'post_html' => $help_tooltip);
            $this->arrEditModeFields['separator_general']['item_file_thumb'] = array('title' => _THUMBNAIL . ' (http://)', 'type' => 'textbox', 'width' => '370px', 'maxlength' => '255', 'required' => false, 'readonly' => false, 'validation_type' => '');
        } else {
            $this->arrEditModeFields['separator_general']['item_file'] = array('title' => _IMAGE, 'type' => 'image', 'width' => '210px', 'required' => true, 'readonly' => false, 'target' => 'images/gallery/', 'thumbnail_create' => true, 'thumbnail_field' => 'item_file_thumb', 'thumbnail_width' => $icon_width, 'thumbnail_height' => $icon_height, 'file_maxsize' => '900k');
        }
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('separator_general' => array('separator_info' => array('legend' => _GENERAL), 'priority_order' => array('title' => _ORDER, 'type' => 'label'), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'source' => $arr_is_active)));
        if ($album_info[0]['album_type'] == 'video') {
            $this->arrDetailsModeFields['separator_general']['item_file'] = array('title' => _VIDEO, 'type' => 'object', 'width' => '240px', 'height' => '200px');
            $this->arrDetailsModeFields['separator_general']['item_file_thumb'] = array('title' => _THUMBNAIL, 'type' => 'label');
        } else {
            $this->arrDetailsModeFields['separator_general']['item_file'] = array('title' => _IMAGE, 'type' => 'image', 'target' => 'images/gallery/', 'no_image' => 'no_image.png');
        }
        ///////////////////////////////////////////////////////////////////////////////
        // 3. add translation fields to all modes
        $this->AddTranslateToModes($this->arrTranslations, array('name' => array('title' => _NAME, 'type' => 'textbox', 'width' => '410px', 'required' => false, 'maxlength' => '125', 'readonly' => false), 'description' => array('title' => _DESCRIPTION, 'type' => 'textarea', 'width' => '410px', 'height' => '70px', 'required' => false, 'maxlength' => '255', 'validation_maxlength' => '255', 'readonly' => false)));
        ///////////////////////////////////////////////////////////////////////////////
    }
コード例 #17
0
    function __construct()
    {
        parent::__construct();
        $this->params = array();
        ## for standard fields
        if (isset($_POST['field1'])) {
            $this->params['field1'] = prepare_input($_POST['field1']);
        }
        if (isset($_POST['field2'])) {
            $this->params['field2'] = prepare_input($_POST['field2']);
        }
        if (isset($_POST['field3'])) {
            $this->params['field3'] = prepare_input($_POST['field3']);
        }
        ## for checkboxes
        //$this->params['field4'] = isset($_POST['field4']) ? prepare_input($_POST['field4']) : '0';
        ## for images (not necessary)
        //if(isset($_POST['icon'])){
        //	$this->params['icon'] = prepare_input($_POST['icon']);
        //}else if(isset($_FILES['icon']['name']) && $_FILES['icon']['name'] != ''){
        //	// nothing
        //}else if (self::GetParameter('action') == 'create'){
        //	$this->params['icon'] = '';
        //}
        ## for files:
        // define nothing
        $this->params['language_id'] = MicroGrid::GetParameter('language_id');
        //$this->uPrefix 		= 'prefix_';
        $this->primaryKey = 'id';
        $this->tableName = DB_PREFIX . 'table';
        // TABLE_NAME
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=page_name';
        $this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowTopButtons = false;
        $this->alertOnDelete = '';
        // leave empty to use default alerts
        $this->allowLanguages = true;
        $this->languageId = $this->params['language_id'] != '' ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = '';
        // WHERE .... / 'WHERE language_id = \''.$this->languageId.'\'';
        $this->GROUP_BY_CLAUSE = '';
        // GROUP BY '.$this->tableName.'.order_number
        $this->ORDER_CLAUSE = '';
        // ORDER BY '.$this->tableName.'.date_created DESC
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        // exporting settings
        $this->isExportingAllowed = false;
        $this->arrExportingTypes = array('csv' => false);
        // define filtering fields
        $this->isFilteringAllowed = false;
        $this->arrFilteringFields = array();
        ///$this->isAggregateAllowed = false;
        ///// define aggregate fields for View Mode
        ///$this->arrAggregateFields = array(
        ///	'field1' => array('function'=>'SUM', 'align'=>'center', 'aggregate_by'=>'', 'decimal_place'=>2),
        ///	'field2' => array('function'=>'AVG', 'align'=>'center', 'aggregate_by'=>'', 'decimal_place'=>2),
        ///);
        ///$date_format = get_date_format('view');
        ///$date_format_settings = get_date_format('view', true); /* to get pure settings format */
        ///$date_format_edit = get_date_format('edit');
        ///$datetime_format = get_datetime_format();
        ///$time_format = get_time_format(); /* by default 1st param - shows seconds */
        ///$currency_format = get_currency_format();
        // prepare languages array
        /// $total_languages = Languages::GetAllActive();
        /// $arr_languages      = array();
        /// foreach($total_languages[0] as $key => $val){
        /// 	$arr_languages[$val['abbreviation']] = $val['lang_name'];
        /// }
        ///////////////////////////////////////////////////////////////////////////////
        // #002. prepare translation fields array
        /// $this->arrTranslations = $this->PrepareTranslateFields(
        ///	array('field1', 'field2')
        /// );
        ///////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////
        // #003. prepare translations array for add/edit/detail modes
        /// REMEMBER! to add '.$sql_translation_description.' in EDIT_MODE_SQL
        /// $sql_translation_description = $this->PrepareTranslateSql(
        ///	TABLE_XXX_DESCRIPTION,
        ///	'gallery_album_id',
        ///	array('field1', 'field2')
        /// );
        ///////////////////////////////////////////////////////////////////////////////
        //----------------------------------------------------------------------
        // VIEW MODE
        // format: strip_tags, nl2br, readonly_text
        // format: 'format'=>'date', 'format_parameter'=>'M d, Y, g:i A'
        // format: 'format'=>'currency', 'format_parameter'=>'european|2' or 'format_parameter'=>'american|4'
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
									field1,
									field2,
									field3
								FROM ' . $this->tableName;
        // define view mode fields
        $this->arrViewModeFields = array();
        //----------------------------------------------------------------------
        // ADD MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address|password|date
        // 	 Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255... Ex.: 'validation_maxlength'=>'255'
        // - Validation Min Length: 4, 6... Ex.: 'validation_minlength'=>'4'
        // - Validation Max Value: 12, 255... Ex.: 'validation_maximum'=>'99.99'
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array();
        //----------------------------------------------------------------------
        // EDIT MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address|password|date
        //   Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255... Ex.: 'validation_maxlength'=>'255'
        // - Validation Min Length: 4, 6... Ex.: 'validation_minlength'=>'4'
        // - Validation Max Value: 12, 255... Ex.: 'validation_maximum'=>'99.99'
        // - for editable passwords they must be defined directly in SQL : '.$this->tableName.'.user_password,
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.field1,
								' . $this->tableName . '.field2,
								' . '
								' . $this->tableName . '.field3
							FROM ' . $this->tableName . '
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array();
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array();
        ///////////////////////////////////////////////////////////////////////////////
        // #004. add translation fields to all modes
        /// $this->AddTranslateToModes(
        /// $this->arrTranslations,
        /// array('name'        => array('title'=>_NAME, 'type'=>'textbox', 'width'=>'410px', 'required'=>true, 'maxlength'=>'', 'readonly'=>false),
        /// 	  'description' => array('title'=>_DESCRIPTION, 'type'=>'textarea', 'width'=>'410px', 'height'=>'90px', 'required'=>false, 'maxlength'=>'', 'maxlength'=>'512', 'validation_maxlength'=>'512', 'readonly'=>false)
        /// )
        /// );
        ///////////////////////////////////////////////////////////////////////////////
    }
コード例 #18
0
    function __construct()
    {
        parent::__construct();
        $this->params = array();
        ## for standard fields
        if (isset($_POST['name'])) {
            $this->params['name'] = prepare_input($_POST['name']);
        }
        if (isset($_POST['is_active'])) {
            $this->params['is_active'] = (int) $_POST['is_active'];
        }
        // $this->params['language_id'] 	  = MicroGrid::GetParameter('language_id');
        $this->primaryKey = 'id';
        $this->tableName = TABLE_LISTINGS_LOCATIONS;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=mod_listings_locations';
        $this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowLanguages = false;
        //$this->languageId  	= ($this->params['language_id'] != '') ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = '';
        // WHERE .... / 'WHERE language_id = \''.$this->languageId.'\'';
        $this->ORDER_CLAUSE = 'ORDER BY name ASC';
        // ORDER BY '.$this->tableName.'.date_created DESC
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 30;
        $this->isSortingAllowed = true;
        $this->isFilteringAllowed = true;
        $arr_default_types = array('0' => _NO, '1' => _YES);
        $arr_activity_types = array('0' => _NO, '1' => _YES);
        // define filtering fields
        $this->arrFilteringFields = array(_NAME => array('table' => $this->tableName, 'field' => 'name', 'type' => 'text', 'sign' => 'like%', 'width' => '100px'), _ACTIVE => array('table' => $this->tableName, 'field' => 'is_active', 'type' => 'dropdownlist', 'source' => $arr_activity_types, 'sign' => '=', 'width' => '90px', 'visible' => true));
        //----------------------------------------------------------------------
        // VIEW MODE
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
									name,
									CONCAT("<a href=index.php?admin=mod_listings_sub_locations&lid=", ' . $this->tableName . '.' . $this->primaryKey . ',
										">[ ", "' . _SUB_LOCATIONS . ' ]</a> (",
										(SELECT COUNT(*) FROM ' . TABLE_LISTINGS_SUB_LOCATIONS . ' sl WHERE sl.location_id = ' . $this->tableName . '.' . $this->primaryKey . '),
										")") as link_sub_locations,
									IF(is_active, \'<span class=yes>' . _YES . '</span>\', \'<span class=no>' . _NO . '</span>\') as mod_is_active
								FROM ' . $this->tableName;
        // define view mode fields
        $this->arrViewModeFields = array('name' => array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => '', 'height' => '', 'maxlength' => ''), 'mod_is_active' => array('title' => _ACTIVE, 'type' => 'label', 'align' => 'center', 'width' => '110px', 'height' => '', 'maxlength' => ''), 'link_sub_locations' => array('title' => '', 'type' => 'label', 'align' => 'left', 'width' => '160px', 'maxlength' => '', 'visible' => true));
        //----------------------------------------------------------------------
        // ADD MODE
        // Validation Type: alpha|numeric|float|alpha_numeric|text|email
        // Validation Sub-Type: positive (for numeric and float)
        // Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array('name' => array('title' => _NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'maxlength' => '50', 'default' => '', 'validation_type' => 'text'), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'required' => true, 'width' => '90px', 'readonly' => false, 'default' => '1', 'source' => $arr_activity_types, 'unique' => false, 'javascript_event' => ''));
        //----------------------------------------------------------------------
        // EDIT MODE
        // Validation Type: alpha|numeric|float|alpha_numeric|text|email
        // Validation Sub-Type: positive (for numeric and float)
        // Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.name,
								' . $this->tableName . '.is_active,
								IF(is_active, \'<span class=yes>' . _YES . '</span>\', \'<span class=no>' . _NO . '</span>\') as mod_is_active
							FROM ' . $this->tableName . '
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('name' => array('title' => _NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'maxlength' => '50', 'default' => '', 'validation_type' => 'text'), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'required' => true, 'width' => '90px', 'readonly' => false, 'default' => '1', 'source' => $arr_activity_types, 'unique' => false, 'javascript_event' => ''));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('name' => array('title' => _NAME, 'type' => 'label'), 'mod_is_active' => array('title' => _ACTIVE, 'type' => 'label'));
    }
コード例 #19
0
    function __construct($listing_id = 0, $account_type = '')
    {
        parent::__construct();
        $this->params = array();
        ## for standard fields
        if (isset($_POST['category_id'])) {
            $this->params['category_id'] = prepare_input($_POST['category_id']);
        }
        if (isset($_POST['listing_id'])) {
            $this->params['listing_id'] = prepare_input($_POST['listing_id']);
        }
        $this->listingId = (int) $listing_id;
        $this->selectedCategoryId = '';
        //$this->params['language_id'] = MicroGrid::GetParameter('language_id');
        //$this->uPrefix 		= 'prefix_';
        $this->primaryKey = 'id';
        $this->tableName = TABLE_LISTINGS_CATEGORIES;
        $this->dataSet = array();
        $this->error = '';
        if ($account_type == 'me') {
            $this->formActionURL = 'index.php?customer=listings_categories&listing_id=' . (int) $listing_id;
        } else {
            $this->formActionURL = 'index.php?admin=mod_listings_categories&listing_id=' . (int) $listing_id;
        }
        $this->actions = array('add' => true, 'edit' => false, 'details' => false, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowTopButtons = false;
        $this->alertOnDelete = '';
        // leave empty to use default alerts
        $this->allowLanguages = false;
        $this->languageId = '';
        //($this->params['language_id'] != '') ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = '';
        // WHERE .... / 'WHERE language_id = ''.$this->languageId.''';
        $this->ORDER_CLAUSE = 'ORDER BY cd.name ASC';
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isExportingAllowed = false;
        $this->arrExportingTypes = array('csv' => false);
        $this->isFilteringAllowed = false;
        // define filtering fields
        $this->arrFilteringFields = array();
        ///$date_format = get_date_format('view');
        ///$date_format_edit = get_date_format('edit');
        ///$currency_format = get_currency_format();
        // prepare categories array
        // existing categories
        $added_categories = self::GetCategoriesForListing($this->listingId);
        $arr_added_categories = array();
        foreach ($added_categories[0] as $key => $val) {
            $arr_added_categories[] = $val['category_id'];
        }
        // subtruct existing categories from all
        $objCategories = Categories::Instance();
        $total_categories = $objCategories->GetAllExistingCategories();
        $arr_categories = array();
        foreach ($total_categories as $key => $val) {
            if (!in_array($val['id'], $arr_added_categories)) {
                if ($val['level'] == '1') {
                    $arr_categories[$val['id']] = $val['name'];
                } else {
                    if ($val['level'] == '2') {
                        $arr_categories[$val['id']] = '&nbsp;&nbsp;&bull; ' . $val['name'];
                    } else {
                        if ($val['level'] == '3') {
                            $arr_categories[$val['id']] = '&nbsp;&nbsp;&nbsp;&nbsp;:: ' . $val['name'];
                        }
                    }
                }
            }
        }
        //----------------------------------------------------------------------
        // VIEW MODE
        // format: strip_tags
        // format: nl2br
        // format: 'format'=>'date', 'format_parameter'=>'M d, Y, g:i A''
        // format: 'format'=>'currency', 'format_parameter'=>'european|2' or 'format_parameter'=>'american|4'
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT
									lc.' . $this->primaryKey . ',
									cd.name,
									cd.description
								FROM ' . $this->tableName . ' lc
									INNER JOIN ' . TABLE_CATEGORIES_DESCRIPTION . ' cd ON lc.category_id = cd.category_id 
									INNER JOIN ' . TABLE_LISTINGS . ' l ON lc.listing_id = l.id
								WHERE
									cd.language_id = \'' . Application::Get('lang') . '\' AND 
									lc.listing_id = ' . $listing_id;
        // define view mode fields
        $this->arrViewModeFields = array('name' => array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => '25%', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'tooltip' => '', 'maxlength' => '40', 'format' => '', 'format_parameter' => ''), 'description' => array('title' => _DESCRIPTION, 'type' => 'label', 'align' => 'left', 'width' => '', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'tooltip' => '', 'maxlength' => '100', 'format' => '', 'format_parameter' => ''));
        //----------------------------------------------------------------------
        // ADD MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address|password|date
        // 	 Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255... Ex.: 'validation_maxlength'=>'255'
        // - Validation Min Length: 4, 6... Ex.: 'validation_minlength'=>'4'
        // - Validation Max Value: 12, 255... Ex.: 'validation_maximum'=>'99.99'
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array('category_id' => array('title' => _CATEGORY, 'type' => 'enum', 'width' => '', 'required' => true, 'readonly' => false, 'default' => '', 'source' => $arr_categories, 'default_option' => '', 'unique' => false, 'javascript_event' => ''), 'listing_id' => array('title' => '', 'type' => 'hidden', 'required' => true, 'readonly' => false, 'default' => $listing_id));
        //----------------------------------------------------------------------
        // EDIT MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address|password|date
        //   Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255... Ex.: 'validation_maxlength'=>'255'
        // - Validation Min Length: 4, 6... Ex.: 'validation_minlength'=>'4'
        // - Validation Max Value: 12, 255... Ex.: 'validation_maximum'=>'99.99'
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								lc.' . $this->primaryKey . ',
								lc.listing_id,
								lc.category_id,
								cd.name as category_name,
								cd.description as category_description
							FROM ' . $this->tableName . ' lc
								INNER JOIN ' . TABLE_CATEGORIES_DESCRIPTION . ' cd ON lc.category_id = cd.category_id
							WHERE lc.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('category_name' => array('title' => _CATEGORY, 'type' => 'label'), 'listing_id' => array('title' => '', 'type' => 'hidden', 'required' => true, 'readonly' => false, 'default' => $listing_id));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('category_name' => array('title' => _CATEGORY, 'type' => 'label'), 'category_description' => array('title' => _DESCRIPTION, 'type' => 'label'));
    }
コード例 #20
0
    function __construct()
    {
        parent::__construct();
        $this->params = array();
        if (isset($_POST['priority_order'])) {
            $this->params['priority_order'] = (int) $_POST['priority_order'];
        }
        if (isset($_POST['parent_id'])) {
            $this->params['parent_id'] = (int) $_POST['parent_id'];
        }
        $name = isset($_POST['descr_name']) ? prepare_input($_POST['descr_name']) : '';
        $description = isset($_POST['descr_description']) ? prepare_input($_POST['descr_description']) : '';
        $cid = isset($_REQUEST['cid']) ? (int) $_REQUEST['cid'] : '0';
        if (isset($_POST['icon'])) {
            $this->params['icon'] = prepare_input($_POST['icon']);
        } else {
            if (isset($_FILES['icon']['name']) && $_FILES['icon']['name'] != '') {
                // nothing
            } else {
                if (self::GetParameter('action') == 'create') {
                    $this->params['icon'] = '';
                }
            }
        }
        // for checkboxes
        /// if(isset($_POST['parameter4']))   $this->params['parameter4'] = $_POST['parameter4']; else $this->params['parameter4'] = '0';
        $this->params['language_id'] = MicroGrid::GetParameter('language_id');
        $rid = MicroGrid::GetParameter('rid');
        $this->primaryKey = 'id';
        $this->tableName = TABLE_CATEGORIES;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=mod_categories&cid=' . (int) $cid;
        $this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->isHtmlEncoding = true;
        $this->allowLanguages = false;
        $this->languageId = '';
        //($this->params['language_id'] != '') ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = '';
        $this->ORDER_CLAUSE = 'ORDER BY ' . TABLE_CATEGORIES . '.parent_id ASC, ' . TABLE_CATEGORIES . '.priority_order ASC';
        $this->categoryCode = isset($_POST['category_code']) ? prepare_input($_POST['category_code']) : '';
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isExportingAllowed = true;
        $this->arrExportingTypes = array('csv' => true);
        $this->isFilteringAllowed = false;
        // define filtering fields
        $this->arrFilteringFields = array();
        $this->isAggregateAllowed = true;
        // define aggregate fields for View Mode
        $this->arrAggregateFields = array('listings_count' => array('function' => 'SUM'));
        // prepare languages array
        //$total_languages = Languages::GetAllActive();
        //$arr_languages      = array();
        //foreach($total_languages[0] as $key => $val){
        //	$arr_languages[$val['abbreviation']] = $val['lang_name'];
        //}
        $level = $this->GetLevel($cid);
        // retrieve default priority order for new record
        $default_priority_order = '';
        if (self::GetParameter('action') == 'add') {
            $default_priority_order = $this->GetMaxOrder('priority_order', 999);
        }
        //----------------------------------------------------------------------
        // VIEW MODE
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->tableName . '.' . $this->primaryKey . ',
									' . $this->tableName . '.icon,
									' . $this->tableName . '.icon_thumb,
									' . $this->tableName . '.parent_id,
									' . $this->tableName . '.priority_order,
									' . $this->tableName . '.listings_count,
									' . TABLE_CATEGORIES_DESCRIPTION . '.language_id,
									' . TABLE_CATEGORIES_DESCRIPTION . '.name,
									' . TABLE_CATEGORIES_DESCRIPTION . '.description,
									CONCAT("<a href=index.php?admin=mod_categories_description&cid=", ' . $this->tableName . '.parent_id, "&cdid=", ' . TABLE_CATEGORIES . '.' . $this->primaryKey . ', ">[ ", "' . _DESCRIPTION . '", " ]</a>") as link_cat_description,
									CONCAT("<a href=index.php?admin=mod_categories&cid=", ' . $this->tableName . '.' . $this->primaryKey . ',
										">[ ", "' . _SUB_CATEGORIES . ' ]</a> (",
										(SELECT COUNT(*) FROM ' . $this->tableName . ' c1 WHERE c1.parent_id = ' . $this->tableName . '.' . $this->primaryKey . '),
										")") as link_sub_categories
								FROM ' . $this->tableName . '
									LEFT OUTER JOIN ' . TABLE_CATEGORIES_DESCRIPTION . ' ON ' . $this->tableName . '.id = ' . TABLE_CATEGORIES_DESCRIPTION . '.category_id
								WHERE
									' . $this->tableName . '.parent_id = ' . (int) $cid . ' AND
									' . TABLE_CATEGORIES_DESCRIPTION . '.language_id = \'' . Application::Get('lang') . '\'';
        // define view mode fields
        $this->arrViewModeFields = array('name' => array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => '', 'maxlength' => ''), 'description' => array('title' => _DESCRIPTION, 'type' => 'label', 'align' => 'left', 'width' => '', 'maxlength' => '30'), 'priority_order' => array('title' => _ORDER, 'type' => 'label', 'align' => 'center', 'width' => '80px', 'maxlength' => '', 'movable' => true), 'listings_count' => array('title' => _LISTINGS, 'type' => 'label', 'align' => 'center', 'width' => '80px', 'maxlength' => ''), 'icon_thumb' => array('title' => _ICON_IMAGE, 'type' => 'image', 'align' => 'center', 'width' => '80px', 'image_width' => '40px', 'image_height' => '30px', 'target' => 'images/categories/', 'no_image' => 'no_image.png'), 'link_sub_categories' => array('title' => '', 'type' => 'label', 'align' => 'center', 'width' => '140px', 'maxlength' => '', 'visible' => $level >= 3 ? false : true), 'link_cat_description' => array('title' => '', 'type' => 'label', 'align' => 'center', 'width' => '100px', 'maxlength' => ''));
        //----------------------------------------------------------------------
        // ADD MODE
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array('descr_name' => array('title' => _NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'default' => $name, 'validation_type' => 'text', 'maxlength' => '50'), 'descr_description' => array('title' => _DESCRIPTION, 'type' => 'textarea', 'width' => '370px', 'height' => '90px', 'required' => false, 'readonly' => false, 'default' => $description, 'validation_type' => 'text', 'validation_maxlength' => '255'), 'icon' => array('title' => _ICON_IMAGE, 'type' => 'image', 'width' => '210px', 'required' => false, 'target' => 'images/categories/', 'no_image' => '', 'random_name' => 'true', 'unique' => false, 'image_width' => '120px', 'image_height' => '90px', 'thumbnail_create' => true, 'thumbnail_field' => 'icon_thumb', 'thumbnail_width' => '115px', 'thumbnail_height' => '', 'file_maxsize' => '200k'), 'priority_order' => array('title' => _ORDER, 'type' => 'textbox', 'width' => '60px', 'maxlength' => '3', 'default' => $default_priority_order, 'required' => true, 'readonly' => false, 'validation_type' => 'numeric'), 'parent_id' => array('title' => '', 'type' => 'hidden', 'required' => false, 'default' => $cid));
        //----------------------------------------------------------------------
        // EDIT MODE
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT ' . $this->tableName . '.' . $this->primaryKey . ',
									' . $this->tableName . '.icon,
									' . $this->tableName . '.icon_thumb,
									' . $this->tableName . '.parent_id,
									' . $this->tableName . '.priority_order,
									' . $this->tableName . '.listings_count,
									' . TABLE_CATEGORIES_DESCRIPTION . '.name as category_name
								FROM ' . $this->tableName . '
									LEFT OUTER JOIN ' . TABLE_CATEGORIES_DESCRIPTION . ' ON ' . $this->tableName . '.id = ' . TABLE_CATEGORIES_DESCRIPTION . '.category_id
								WHERE
									' . TABLE_CATEGORIES_DESCRIPTION . '.language_id = \'' . Application::Get('lang') . '\' AND
								    ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('category_name' => array('title' => _NAME, 'type' => 'label'), 'icon' => array('title' => _ICON_IMAGE, 'type' => 'image', 'width' => '210px', 'required' => false, 'target' => 'images/categories/', 'no_image' => '', 'random_name' => 'true', 'unique' => false, 'image_width' => '120px', 'image_height' => '90px', 'thumbnail_create' => true, 'thumbnail_field' => 'icon_thumb', 'thumbnail_width' => '115px', 'thumbnail_height' => '', 'file_maxsize' => '200k'), 'listings_count' => array('title' => _LISTINGS, 'type' => 'label'), 'priority_order' => array('title' => _ORDER, 'type' => 'textbox', 'width' => '60px', 'maxlength' => '3', 'default' => '0', 'required' => true, 'readonly' => false, 'validation_type' => 'numeric'));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('category_name' => array('title' => _NAME, 'type' => 'label'), 'icon' => array('title' => _ICON_IMAGE, 'type' => 'image', 'target' => 'images/categories/', 'no_image' => 'no_image.png'), 'listings_count' => array('title' => _LISTINGS, 'type' => 'label'), 'priority_order' => array('title' => _ORDER, 'type' => 'label'));
    }
コード例 #21
0
ファイル: Modules.class.php プロジェクト: mozdial/Directory
    function __construct($id = '')
    {
        parent::__construct();
        //////////////////////////////////////////////////////////////////
        $this->id = $id;
        if ($this->id != '') {
            $sql = 'SELECT
						id, name, name_const, description_const, icon_file, module_tables, dependent_modules, is_installed, is_system, priority_order, settings_access_by
					FROM ' . TABLE_MODULES . '
					WHERE id = \'' . intval($this->id) . '\'';
            $this->modules = database_query($sql, DATA_AND_ROWS, ALL_ROWS);
        } else {
            $this->modules = $this->GetAllModules();
        }
        $this->modulesCount = $this->modules[1];
        //////////////////////////////////////////////////////////////////
        $this->params = array();
        ## for standard fields
        if (isset($_POST['is_installed'])) {
            $this->params['is_installed'] = prepare_input($_POST['is_installed']);
        }
        ## for checkboxes
        //$this->params['field4'] = isset($_POST['field4']) ? prepare_input($_POST['field4']) : '0';
        ## for images (not necessary)
        //if(isset($_POST['icon'])){
        //	$this->params['icon'] = prepare_input($_POST['icon']);
        //}else if(isset($_FILES['icon']['name']) && $_FILES['icon']['name'] != ''){
        //	// nothing
        //}else if (self::GetParameter('action') == 'create'){
        //	$this->params['icon'] = '';
        //}
        ## for files:
        // define nothing
        $this->params['language_id'] = MicroGrid::GetParameter('language_id');
        //$this->uPrefix 		= 'prefix_';
        $this->primaryKey = 'id';
        $this->tableName = TABLE_MODULES;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=modules';
        $this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowLanguages = false;
        $this->languageId = '';
        //
        $this->WHERE_CLAUSE = '';
        // WHERE .... / 'WHERE language_id = \''.$this->languageId.'\'';
        $this->ORDER_CLAUSE = 'ORDER BY is_system DESC, priority_order DESC';
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isFilteringAllowed = false;
        // define filtering fields
        $this->arrFilteringFields = array();
        $arr_installed = array('0' => _NO, '1' => _YES);
        $arr_system = array('0' => _NO, '1' => _YES);
        // prepare languages array
        /// $total_languages = Languages::GetAllActive();
        /// $arr_languages      = array();
        /// foreach($total_languages[0] as $key => $val){
        /// 	$arr_languages[$val['abbreviation']] = $val['lang_name'];
        /// }
        //----------------------------------------------------------------------
        // VIEW MODE
        // format: strip_tags
        // format: nl2br
        // format: 'format'=>'date', 'format_parameter'=>'M d, Y, g:i A' + IF(date_created = '0000-00-00 00:00:00', '', date_created) as date_created,
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
									CONCAT(UCASE(SUBSTRING(name, 1, 1)),LCASE(SUBSTRING(name, 2))) as mod_name,
									icon_file,
									name_const,
									description_const, 
									module_tables,
									dependent_modules,
									CASE
										WHEN is_installed = 1 THEN \'success_sign.gif\'
										ELSE \'error_sign.gif\'								
									END as mod_is_installed,
									CASE
										WHEN is_system = 1 THEN \'success_sign.gif\'
										ELSE \'error_sign.gif\'								
									END as mod_is_system
								FROM ' . $this->tableName;
        // define view mode fields
        $this->arrViewModeFields = array('icon_file' => array('title' => _IMAGE, 'type' => 'image', 'align' => 'left', 'width' => '60px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'image_width' => '42px', 'image_height' => '42px', 'target' => 'images/modules_icons/', 'no_image' => 'no_image.png'), 'mod_name' => array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => '', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'tooltip' => '', 'maxlength' => '', 'format' => '', 'format_parameter' => ''), 'mod_is_installed' => array('title' => _STATUS, 'type' => 'image', 'align' => 'center', 'width' => '120px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'image_width' => '16px', 'image_height' => '16px', 'target' => 'images/', 'no_image' => 'error_sign.gif'));
        //----------------------------------------------------------------------
        // ADD MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address|password|date
        // 	 Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255... Ex.: 'validation_maxlength'=>'255'
        // - Validation Max Value: 12, 255... Ex.: 'validation_maximum'=>'99.99'
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array();
        //----------------------------------------------------------------------
        // EDIT MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address|password|date
        //   Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255... Ex.: 'validation_maxlength'=>'255'
        // - Validation Max Value: 12, 255... Ex.: 'validation_maximum'=>'99.99'
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								CONCAT(UCASE(REPLACE(' . $this->tableName . '.name,"_"," "))) as mod_name,
								' . $this->tableName . '.name,								        
								' . $this->tableName . '.name_const,
								' . $this->tableName . '.description_const, 								
								' . $this->tableName . '.icon_file,
								' . $this->tableName . '.module_tables,
								' . $this->tableName . '.dependent_modules,
								' . $this->tableName . '.is_installed,
								' . $this->tableName . '.is_system,
								"1" as truncate_tables,
								IF(' . TABLE_VOCABULARY . '.key_text IS NOT NULL, ' . TABLE_VOCABULARY . '.key_text, "") as mod_description
							FROM ' . $this->tableName . '
								LEFT OUTER JOIN ' . TABLE_VOCABULARY . ' ON (' . $this->tableName . '.description_const = ' . TABLE_VOCABULARY . '.key_value AND ' . TABLE_VOCABULARY . '.language_id = \'' . Application::Get('lang') . '\')
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('mod_name' => array('title' => _NAME, 'type' => 'label'), 'mod_description' => array('title' => _DESCRIPTION, 'type' => 'label'), 'icon_file' => array('title' => _ICON_IMAGE, 'type' => 'image', 'width' => '', 'readonly' => true, 'required' => false, 'target' => 'images/modules_icons/', 'no_image' => '', 'random_name' => true, 'overwrite_image' => false, 'unique' => false, 'image_width' => '96px', 'image_height' => '96px', 'thumbnail_create' => false, 'thumbnail_field' => '', 'thumbnail_width' => '', 'thumbnail_height' => ''), 'is_system' => array('title' => _SYSTEM_MODULE, 'type' => 'enum', 'width' => '', 'required' => false, 'readonly' => true, 'source' => $arr_system, 'unique' => false), 'is_installed' => array('title' => _INSTALLED, 'type' => 'enum', 'width' => '', 'required' => true, 'readonly' => false, 'source' => $arr_installed, 'unique' => false, 'javascript_event' => 'onchange="appToggleElementReadonly(this.value,0,\'truncate_tables\',false,true,false)"'), 'truncate_tables' => array('title' => _TRUNCATE_RELATED_TABLES, 'type' => 'checkbox', 'readonly' => false, 'true_value' => '1', 'false_value' => '0', 'unique' => false));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array();
    }
コード例 #22
0
    function __construct()
    {
        parent::__construct();
        global $objLogin;
        $this->params = array();
        if (isset($_POST['album_code'])) {
            $this->params['album_code'] = prepare_input($_POST['album_code']);
        }
        if (isset($_POST['album_type'])) {
            $this->params['album_type'] = prepare_input($_POST['album_type']);
        }
        if (isset($_POST['priority_order'])) {
            $this->params['priority_order'] = prepare_input($_POST['priority_order']);
        }
        if (isset($_POST['is_active'])) {
            $this->params['is_active'] = prepare_input($_POST['is_active']);
        } else {
            $this->params['is_active'] = '0';
        }
        $this->primaryKey = 'id';
        $this->tableName = TABLE_GALLERY_ALBUMS;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=mod_gallery_management';
        $this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowTopButtons = true;
        $this->allowLanguages = false;
        $this->languageId = $objLogin->GetPreferredLang();
        $this->WHERE_CLAUSE = '';
        // WHERE...
        $this->ORDER_CLAUSE = 'ORDER BY priority_order ASC';
        // ORDER BY date_created DESC
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isFilteringAllowed = false;
        // define filtering fields
        $this->arrFilteringFields = array();
        ///////////////////////////////////////////////////////////////////////////////
        // 1. prepare translation fields array
        $this->arrTranslations = $this->PrepareTranslateFields(array('name', 'description'));
        ///////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////
        // 2. prepare translations array for edit/detail modes
        $sql_translation_description = $this->PrepareTranslateSql(TABLE_GALLERY_ALBUMS_DESCRIPTION, 'gallery_album_id', array('name', 'description'));
        ///////////////////////////////////////////////////////////////////////////////
        // prepare album types array
        $arr_album_types = array('images' => _IMAGES, 'video' => _VIDEO);
        $arr_is_active = array('0' => '<span class=no>' . _NO . '</span>', '1' => '<span class=yes>' . _YES . '</span>');
        //----------------------------------------------------------------------
        // VIEW MODE
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT
									ga.' . $this->primaryKey . ',
		                            ga.album_code,
									ga.album_type,
									UCASE(ga.album_code) as mod_album_code,
									CONCAT(UCASE(SUBSTRING(ga.album_type, 1, 1)),LCASE(SUBSTRING(ga.album_type, 2))) as mod_album_type,
									gad.name,
									gad.description,
									ga.priority_order,
									ga.is_active,
									CONCAT("<a href=index.php?admin=mod_gallery_upload_items&album=", album_code, ">' . _UPLOAD . '</a> (", (SELECT COUNT(*) as cnt FROM ' . TABLE_GALLERY_ALBUM_ITEMS . ' gi WHERE gi.album_code = ga.album_code) , ")") as link_upload_items
								FROM (' . $this->tableName . ' ga	
									LEFT OUTER JOIN ' . TABLE_GALLERY_ALBUMS_DESCRIPTION . ' gad ON ga.id = gad.gallery_album_id AND gad.language_id = \'' . $this->languageId . '\')';
        // define view mode fields
        $this->arrViewModeFields = array('name' => array('title' => _ALBUM_NAME, 'type' => 'label', 'align' => 'left', 'width' => '15%', 'maxlength' => '30'), 'description' => array('title' => _DESCRIPTION, 'type' => 'label', 'align' => 'left', 'width' => '', 'maxlength' => '50'), 'mod_album_code' => array('title' => _ALBUM_CODE, 'type' => 'label', 'align' => 'center', 'width' => '12%'), 'mod_album_type' => array('title' => _TYPE, 'type' => 'label', 'align' => 'center', 'width' => '8%'), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'align' => 'center', 'width' => '8%', 'sortable' => true, 'nowrap' => '', 'visible' => true, 'source' => $arr_is_active), 'priority_order' => array('title' => _ORDER, 'type' => 'label', 'align' => 'center', 'width' => '8%', 'movable' => true), 'link_upload_items' => array('title' => _ITEMS, 'type' => 'label', 'align' => 'center', 'width' => '12%'));
        //----------------------------------------------------------------------
        // ADD MODE
        //----------------------------------------------------------------------
        // define add mode fields
        $max_order = self::GetParameter('action') == 'add' ? $this->GetMaxOrder('priority_order', 999) : 0;
        $this->arrAddModeFields = array('separator_general' => array('separator_info' => array('legend' => _GENERAL), 'album_code' => array('title' => '', 'type' => 'hidden', 'required' => true, 'readonly' => false, 'default' => get_random_string(8)), 'album_type' => array('title' => _TYPE, 'type' => 'enum', 'required' => true, 'readonly' => false, 'source' => $arr_album_types), 'priority_order' => array('title' => _ORDER, 'type' => 'textbox', 'width' => '50px', 'maxlength' => '3', 'default' => $max_order, 'required' => true, 'readonly' => false, 'validation_type' => 'numeric'), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'readonly' => false, 'true_value' => '1', 'false_value' => '0', 'default' => '1')));
        //----------------------------------------------------------------------
        // EDIT MODE
        //----------------------------------------------------------------------
        // define edit mode fields
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								UCASE(' . $this->tableName . '.album_code) as album_code,
								' . $this->tableName . '.album_type,
								CONCAT(UCASE(SUBSTRING(' . $this->tableName . '.album_type, 1, 1)),LCASE(SUBSTRING(' . $this->tableName . '.album_type, 2))) as mod_album_type,
								' . $sql_translation_description . '
								' . $this->tableName . '.priority_order,
								' . $this->tableName . '.is_active
							FROM ' . $this->tableName . '
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('separator_general' => array('separator_info' => array('legend' => _GENERAL), 'album_code' => array('title' => _CODE, 'type' => 'label'), 'album_type' => array('title' => _TYPE, 'type' => 'enum', 'required' => true, 'readonly' => false, 'source' => $arr_album_types), 'priority_order' => array('title' => _ORDER, 'type' => 'textbox', 'width' => '50px', 'maxlength' => '3', 'required' => true, 'readonly' => false, 'validation_type' => 'numeric'), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'readonly' => false, 'true_value' => '1', 'false_value' => '0')));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('separator_general' => array('separator_info' => array('legend' => _GENERAL), 'album_code' => array('title' => _CODE, 'type' => 'label'), 'mod_album_type' => array('title' => _TYPE, 'type' => 'label'), 'priority_order' => array('title' => _ORDER, 'type' => 'label'), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'source' => $arr_is_active)));
        ///////////////////////////////////////////////////////////////////////////////
        // 3. add translation fields to all modes
        $this->AddTranslateToModes($this->arrTranslations, array('name' => array('title' => _NAME, 'type' => 'textbox', 'width' => '410px', 'required' => true, 'maxlength' => '125', 'readonly' => false), 'description' => array('title' => _DESCRIPTION, 'type' => 'textarea', 'width' => '410px', 'height' => '90px', 'required' => false, 'maxlength' => '255', 'validation_maxlength' => '255', 'readonly' => false)));
        ///////////////////////////////////////////////////////////////////////////////
    }
コード例 #23
0
    function __construct()
    {
        parent::__construct();
        global $objLogin;
        $this->params = array();
        if (isset($_POST['price'])) {
            $this->params['price'] = prepare_input($_POST['price']);
        }
        if (isset($_POST['listings_count'])) {
            $this->params['listings_count'] = prepare_input($_POST['listings_count']);
        }
        if (isset($_POST['categories_count'])) {
            $this->params['categories_count'] = prepare_input($_POST['categories_count']);
        }
        if (isset($_POST['keywords_count'])) {
            $this->params['keywords_count'] = prepare_input($_POST['keywords_count']);
        }
        if (isset($_POST['inquiries_count'])) {
            $this->params['inquiries_count'] = prepare_input($_POST['inquiries_count']);
        }
        if (isset($_POST['images_count'])) {
            $this->params['images_count'] = prepare_input($_POST['images_count']);
        }
        if (isset($_POST['duration'])) {
            $this->params['duration'] = prepare_input($_POST['duration']);
        }
        // for checkboxes
        if (isset($_POST['is_default'])) {
            $this->params['is_default'] = (int) $_POST['is_default'];
        } else {
            $this->params['is_default'] = '0';
        }
        if (isset($_POST['business_name'])) {
            $this->params['business_name'] = (int) $_POST['business_name'];
        } else {
            $this->params['business_name'] = '0';
        }
        if (isset($_POST['business_description'])) {
            $this->params['business_description'] = (int) $_POST['business_description'];
        } else {
            $this->params['business_description'] = '0';
        }
        if (isset($_POST['logo'])) {
            $this->params['logo'] = (int) $_POST['logo'];
        } else {
            $this->params['logo'] = '0';
        }
        if (isset($_POST['phone'])) {
            $this->params['phone'] = (int) $_POST['phone'];
        } else {
            $this->params['phone'] = '0';
        }
        if (isset($_POST['address'])) {
            $this->params['address'] = (int) $_POST['address'];
        } else {
            $this->params['address'] = '0';
        }
        if (isset($_POST['map'])) {
            $this->params['map'] = (int) $_POST['map'];
        } else {
            $this->params['map'] = '0';
        }
        if (isset($_POST['inquiry_button'])) {
            $this->params['inquiry_button'] = (int) $_POST['inquiry_button'];
        } else {
            $this->params['inquiry_button'] = '0';
        }
        if (isset($_POST['rating_button'])) {
            $this->params['rating_button'] = (int) $_POST['rating_button'];
        } else {
            $this->params['rating_button'] = '0';
        }
        if (isset($_POST['video_link'])) {
            $this->params['video_link'] = (int) $_POST['video_link'];
        } else {
            $this->params['video_link'] = '0';
        }
        $this->params['language_id'] = MicroGrid::GetParameter('language_id');
        //$this->uPrefix 		= 'prefix_';
        $this->primaryKey = 'id';
        $this->tableName = TABLE_ADVERTISE_PLANS;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=mod_payments_advertise_plans';
        $this->actions = array('add' => false, 'edit' => true, 'details' => true, 'delete' => false);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowTopButtons = true;
        $this->alertOnDelete = '';
        // leave empty to use default alerts
        $this->allowLanguages = false;
        $this->languageId = $objLogin->GetPreferredLang();
        $this->WHERE_CLAUSE = '';
        // WHERE .... / 'WHERE language_id = \''.$this->languageId.'\'';
        $this->ORDER_CLAUSE = '';
        // ORDER BY '.$this->tableName.'.date_created DESC
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isExportingAllowed = false;
        $this->arrExportingTypes = array('csv' => false);
        $this->isFilteringAllowed = false;
        // define filtering fields
        $this->arrFilteringFields = array();
        $inquiry_field_visible = Modules::IsModuleInstalled('inquiries') == 'yes' ? true : false;
        $ratings_field_visible = Modules::IsModuleInstalled('ratings') == 'yes' ? true : false;
        ///$this->isAggregateAllowed = false;
        ///// define aggregate fields for View Mode
        ///$this->arrAggregateFields = array(
        ///	'field1' => array('function'=>'SUM'),
        ///	'field2' => array('function'=>'AVG'),
        ///);
        ///$date_format = get_date_format('view');
        ///$date_format_edit = get_date_format('edit');
        ///$datetime_format = get_datetime_format();
        $this->currency_format = get_currency_format();
        $pre_currency_symbol = Application::Get('currency_symbol_place') == 'left' ? Application::Get('currency_symbol') : '';
        $post_currency_symbol = Application::Get('currency_symbol_place') == 'right' ? Application::Get('currency_symbol') : '';
        $arr_durations = self::PrepareDurationsArray();
        $arr_inquiries = array('0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10', '14' => '15', '20' => '20', '30' => '30', '40' => '40', '50' => '50', '75' => '75', '100' => '100', '150' => '150', '200' => '200', '250' => '250', '500' => '500', '750' => '750', '1000' => '1000', '-1' => _UNLIMITED);
        $arr_images = array('0' => '0', '1' => '1', '2' => '2', '3' => '3');
        $max_categories = (int) ModulesSettings::Get('listings', 'maximum_categories');
        $arr_categories = array();
        for ($i = 0; $i < $max_categories; $i++) {
            $arr_categories[$i + 1] = $i + 1;
        }
        ///////////////////////////////////////////////////////////////////////////////
        // 002. prepare translation fields array
        $this->arrTranslations = $this->PrepareTranslateFields(array('name', 'description'));
        ///////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////
        // 003. prepare translations array for add/edit/detail modes
        $sql_translation_description = $this->PrepareTranslateSql(TABLE_ADVERTISE_PLANS_DESCRIPTION, 'advertise_plan_id', array('name', 'description'));
        ///////////////////////////////////////////////////////////////////////////////
        //----------------------------------------------------------------------
        // VIEW MODE
        // format: strip_tags
        // format: nl2br
        // format: 'format'=>'date', 'format_parameter'=>'M d, Y, g:i A'
        // format: 'format'=>'currency', 'format_parameter'=>'european|2' or 'format_parameter'=>'american|4'
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT
									ap.' . $this->primaryKey . ',
									ap.listings_count,
									ap.categories_count,
									ap.business_name,
									ap.business_description,
									ap.price,
									ap.duration,
									IF(is_default, "<span class=yes>' . _YES . '</span>", "<span>' . _NO . '</span>") as is_default,
									apd.name
								FROM ' . $this->tableName . ' ap
									LEFT OUTER JOIN ' . TABLE_ADVERTISE_PLANS_DESCRIPTION . ' apd ON ap.id = apd.advertise_plan_id AND apd.language_id = \'' . $this->languageId . '\'';
        // define view mode fields
        $this->arrViewModeFields = array('name' => array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => '', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'tooltip' => '', 'maxlength' => '', 'format' => '', 'format_parameter' => ''), 'listings_count' => array('title' => _LISTINGS_COUNT, 'type' => 'label', 'align' => 'center', 'width' => '120px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'tooltip' => '', 'maxlength' => ''), 'categories_count' => array('title' => _CATEGORIES_COUNT, 'type' => 'label', 'align' => 'center', 'width' => '120px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'tooltip' => '', 'maxlength' => ''), 'duration' => array('title' => _DURATION, 'type' => 'enum', 'align' => 'center', 'width' => '100px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'source' => $arr_durations), 'price' => array('title' => _PRICE, 'type' => 'label', 'align' => 'right', 'width' => '90px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'tooltip' => '', 'maxlength' => '', 'format' => 'currency', 'format_parameter' => $this->currency_format . '|2', 'pre_html' => $pre_currency_symbol, 'post_html' => $post_currency_symbol), 'is_default' => array('title' => _DEFAULT, 'type' => 'label', 'align' => 'center', 'width' => '100px', 'height' => '', 'maxlength' => ''));
        //----------------------------------------------------------------------
        // ADD MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address|password|date
        // 	 Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255... Ex.: 'validation_maxlength'=>'255'
        // - Validation Min Length: 4, 6... Ex.: 'validation_minlength'=>'4'
        // - Validation Max Value: 12, 255... Ex.: 'validation_maximum'=>'99.99'
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array();
        //----------------------------------------------------------------------
        // EDIT MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address|password|date
        //   Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255... Ex.: 'validation_maxlength'=>'255'
        // - Validation Min Length: 4, 6... Ex.: 'validation_minlength'=>'4'
        // - Validation Max Value: 12, 255... Ex.: 'validation_maximum'=>'99.99'
        // - for editable passwords they must be defined directly in SQL : '.$this->tableName.'.user_password,
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
									' . $this->primaryKey . ',									
									listings_count,
									categories_count,
									keywords_count,
									inquiries_count,
									inquiry_button,
									rating_button,
									price,
									' . $sql_translation_description . '
									duration,
									is_default,
									business_name,
									business_description,
									logo,
									images_count,
									video_link,
									phone,
									address,
									map,
									IF(business_name, "<span class=yes>' . _YES . '</span>", "<span class=no>' . _NO . '</span>") as mod_business_name,
									IF(business_description, "<span class=yes>' . _YES . '</span>", "<span class=no>' . _NO . '</span>") as mod_business_description,
									IF(logo, "<span class=yes>' . _YES . '</span>", "<span class=no>' . _NO . '</span>") as mod_logo,
									IF(phone, "<span class=yes>' . _YES . '</span>", "<span class=no>' . _NO . '</span>") as mod_phone,
									IF(video_link, "<span class=yes>' . _YES . '</span>", "<span class=no>' . _NO . '</span>") as mod_video_link,
									IF(address, "<span class=yes>' . _YES . '</span>", "<span class=no>' . _NO . '</span>") as mod_address,
									IF(map, "<span class=yes>' . _YES . '</span>", "<span class=no>' . _NO . '</span>") as mod_map,
									IF(inquiry_button, "<span class=yes>' . _YES . '</span>", "<span class=no>' . _NO . '</span>") as mod_inquiry_button,
									IF(rating_button, "<span class=yes>' . _YES . '</span>", "<span class=no>' . _NO . '</span>") as mod_rating_button,
									IF(is_default, "<span class=yes>' . _YES . '</span>", "<span class=no>' . _NO . '</span>") as mod_is_default
								FROM ' . $this->tableName . ' 
								WHERE ' . $this->primaryKey . ' = _RID_';
        $rid = MicroGrid::GetParameter('rid');
        $sql = 'SELECT is_default FROM ' . TABLE_ADVERTISE_PLANS . ' WHERE id = ' . (int) $rid;
        $readonly = false;
        if ($result = database_query($sql, DATA_ONLY, FIRST_ROW_ONLY)) {
            $readonly = isset($result['is_default']) && $result['is_default'] == '1' ? true : false;
        }
        // define edit mode fields
        $this->arrEditModeFields = array('separator_general' => array('separator_info' => array('legend' => _GENERAL_INFO, 'columns' => '2'), 'price' => array('title' => _PRICE, 'type' => 'textbox', 'width' => '90px', 'required' => true, 'readonly' => false, 'maxlength' => '10', 'default' => '0', 'validation_type' => 'float|positive', 'unique' => false, 'visible' => true, 'pre_html' => $pre_currency_symbol . ' ', 'post_html' => $post_currency_symbol), 'business_name' => array('title' => _NAME, 'type' => 'checkbox', 'readonly' => false, 'default' => '0', 'true_value' => '1', 'false_value' => '0'), 'duration' => array('title' => _DURATION, 'type' => 'enum', 'width' => '', 'required' => true, 'readonly' => false, 'default' => '', 'source' => $arr_durations, 'default_option' => '', 'unique' => false, 'javascript_event' => ''), 'business_description' => array('title' => _DESCRIPTION, 'type' => 'checkbox', 'readonly' => false, 'default' => '0', 'true_value' => '1', 'false_value' => '0'), 'categories_count' => array('title' => _CATEGORIES_COUNT, 'type' => 'enum', 'width' => '', 'required' => true, 'readonly' => false, 'default' => '', 'source' => $arr_categories, 'default_option' => '', 'unique' => false, 'javascript_event' => ''), 'phone' => array('title' => _PHONE, 'type' => 'checkbox', 'readonly' => false, 'default' => '0', 'true_value' => '1', 'false_value' => '0'), 'listings_count' => array('title' => _LISTINGS_COUNT, 'type' => 'textbox', 'width' => '50px', 'required' => true, 'readonly' => false, 'maxlength' => '4', 'default' => '1', 'validation_type' => 'numeric|positive', 'validation_maximum' => '9999', 'unique' => false, 'visible' => true), 'address' => array('title' => _ADDRESS, 'type' => 'checkbox', 'readonly' => false, 'default' => '0', 'true_value' => '1', 'false_value' => '0'), 'inquiry_button' => array('title' => _INQUIRY_BUTTON, 'type' => 'checkbox', 'readonly' => false, 'default' => '0', 'true_value' => '1', 'false_value' => '0', 'visible' => $inquiry_field_visible), 'map' => array('title' => _MAP, 'type' => 'checkbox', 'readonly' => false, 'default' => '0', 'true_value' => '1', 'false_value' => '0'), 'inquiries_count' => array('title' => _INQUIRIES_COUNT, 'type' => 'enum', 'width' => '', 'required' => true, 'readonly' => false, 'default' => '', 'source' => $arr_inquiries, 'default_option' => '', 'unique' => false, 'javascript_event' => '', 'post_html' => ' ' . _PER_MONTH, 'visible' => $inquiry_field_visible), 'rating_button' => array('title' => _RATING_BUTTON, 'type' => 'checkbox', 'readonly' => false, 'default' => '0', 'true_value' => '1', 'false_value' => '0', 'visible' => $ratings_field_visible), 'logo' => array('title' => _LOGO, 'type' => 'checkbox', 'readonly' => false, 'default' => '0', 'true_value' => '1', 'false_value' => '0'), 'keywords_count' => array('title' => _KEYWORDS_COUNT, 'type' => 'textbox', 'width' => '50px', 'required' => true, 'readonly' => false, 'maxlength' => '2', 'default' => '0', 'validation_type' => 'numeric|positive', 'validation_maximum' => '99', 'unique' => false, 'visible' => true), 'images_count' => array('title' => _IMAGES, 'type' => 'enum', 'width' => '', 'required' => true, 'readonly' => false, 'default' => '', 'source' => $arr_images, 'default_option' => '', 'unique' => false, 'javascript_event' => ''), 'video_link' => array('title' => _VIDEO, 'type' => 'checkbox', 'readonly' => false, 'default' => '0', 'true_value' => '1', 'false_value' => '0'), 'is_default' => array('title' => _DEFAULT, 'type' => 'checkbox', 'readonly' => $readonly, 'default' => '0', 'true_value' => '1', 'false_value' => '0')));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('separator_general' => array('separator_info' => array('legend' => _GENERAL_INFO, 'columns' => '2'), 'price' => array('title' => _PRICE, 'type' => 'label', 'pre_html' => $pre_currency_symbol . ' ', 'post_html' => $post_currency_symbol), 'mod_business_name' => array('title' => _NAME, 'type' => 'label'), 'duration' => array('title' => _DURATION, 'type' => 'enum', 'source' => $arr_durations), 'mod_business_description' => array('title' => _DESCRIPTION, 'type' => 'label'), 'categories_count' => array('title' => _CATEGORIES_COUNT, 'type' => 'enum', 'source' => $arr_categories), 'mod_phone' => array('title' => _PHONE, 'type' => 'label'), 'listings_count' => array('title' => _LISTINGS_COUNT, 'type' => 'label'), 'mod_address' => array('title' => _ADDRESS, 'type' => 'label'), 'mod_inquiry_button' => array('title' => _INQUIRY_BUTTON, 'type' => 'label', 'visible' => $inquiry_field_visible), 'mod_map' => array('title' => _MAP, 'type' => 'label'), 'inquiries_count' => array('title' => _INQUIRIES_COUNT, 'type' => 'enum', 'source' => $arr_inquiries, 'post_html' => ' ' . _PER_MONTH, 'visible' => $inquiry_field_visible), 'mod_rating_button' => array('title' => _RATING_BUTTON, 'type' => 'label'), 'mod_logo' => array('title' => _LOGO, 'type' => 'label'), 'keywords_count' => array('title' => _KEYWORDS_COUNT, 'type' => 'label'), 'images_count' => array('title' => _IMAGES, 'type' => 'label'), 'mod_video_link' => array('title' => _VIDEO, 'type' => 'label'), 'mod_is_default' => array('title' => _DEFAULT, 'type' => 'label')));
        ///////////////////////////////////////////////////////////////////////////////
        // 004. add translation fields to all modes
        $this->AddTranslateToModes($this->arrTranslations, array('name' => array('title' => _NAME, 'type' => 'textbox', 'width' => '410px', 'required' => true, 'maxlength' => '125', 'readonly' => false), 'description' => array('title' => _DESCRIPTION, 'type' => 'textarea', 'width' => '410px', 'height' => '90px', 'required' => false, 'validation_maxlength' => '512', 'readonly' => false)));
        ///////////////////////////////////////////////////////////////////////////////
    }
コード例 #24
0
    function __construct($login_type = '')
    {
        parent::__construct();
        global $objSettings;
        $this->params = array();
        if (isset($_POST['first_name'])) {
            $this->params['first_name'] = prepare_input($_POST['first_name']);
        }
        if (isset($_POST['last_name'])) {
            $this->params['last_name'] = prepare_input($_POST['last_name']);
        }
        if (isset($_POST['user_name'])) {
            $this->params['user_name'] = prepare_input($_POST['user_name']);
        }
        if (isset($_POST['password'])) {
            $this->params['password'] = prepare_input($_POST['password']);
        }
        if (isset($_POST['email'])) {
            $this->params['email'] = prepare_input($_POST['email']);
        }
        if (isset($_POST['preferred_language'])) {
            $this->params['preferred_language'] = prepare_input($_POST['preferred_language']);
        }
        if (isset($_POST['account_type'])) {
            $this->params['account_type'] = prepare_input($_POST['account_type']);
        }
        if (isset($_POST['date_created'])) {
            $this->params['date_created'] = prepare_input($_POST['date_created']);
        }
        if (isset($_POST['is_active'])) {
            $this->params['is_active'] = (int) $_POST['is_active'];
        } else {
            $this->params['is_active'] = '0';
        }
        if (self::$PROJECT == 'HotelSite') {
            if (isset($_POST['hotels'])) {
                $this->params['hotels'] = prepare_input($_POST['hotels']);
            }
        }
        $this->primaryKey = 'id';
        $this->tableName = TABLE_ACCOUNTS;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=admins_management';
        $this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowLanguages = false;
        if ($login_type == 'owner') {
            $this->WHERE_CLAUSE = 'WHERE (' . TABLE_ACCOUNTS . '.account_type = \'mainadmin\' || ' . TABLE_ACCOUNTS . '.account_type = \'admin\' || ' . TABLE_ACCOUNTS . '.account_type = \'hotelowner\')';
        } else {
            if ($login_type == 'mainadmin') {
                $this->WHERE_CLAUSE = 'WHERE (' . TABLE_ACCOUNTS . '.account_type = \'admin\' || ' . TABLE_ACCOUNTS . '.account_type = \'hotelowner\')';
            } else {
                if ($login_type == 'admin') {
                    $this->WHERE_CLAUSE = 'WHERE ' . TABLE_ACCOUNTS . '.account_type = \'admin\'';
                } else {
                    if ($login_type == 'hotelowner') {
                        $this->WHERE_CLAUSE = 'WHERE ' . TABLE_ACCOUNTS . '.account_type = \'hotelowner\'';
                    }
                }
            }
        }
        $this->ORDER_CLAUSE = 'ORDER BY id ASC';
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isFilteringAllowed = true;
        // define filtering fields
        $this->arrFilteringFields = array(_FIRST_NAME => array('table' => $this->tableName, 'field' => 'first_name', 'type' => 'text', 'sign' => 'like%', 'width' => '80px'), _LAST_NAME => array('table' => $this->tableName, 'field' => 'last_name', 'type' => 'text', 'sign' => 'like%', 'width' => '80px'), _ACTIVE => array('table' => $this->tableName, 'field' => 'is_active', 'type' => 'dropdownlist', 'source' => array('0' => _NO, '1' => _YES), 'sign' => '=', 'width' => '85px'));
        // prepare languages array
        $total_languages = Languages::GetAllActive();
        $arr_languages = array();
        foreach ($total_languages[0] as $key => $val) {
            $arr_languages[$val['abbreviation']] = $val['lang_name'];
        }
        $arr_account_types = array('admin' => _ADMIN, 'mainadmin' => _MAIN_ADMIN);
        if (self::$PROJECT == 'HotelSite') {
            $arr_account_types['hotelowner'] = _HOTEL_OWNER;
        }
        $arr_is_active = array('0' => '<span class=no>' . _NO . '</span>', '1' => '<span class=yes>' . _YES . '</span>');
        $datetime_format = get_datetime_format();
        if (self::$PROJECT == 'HotelSite') {
            $total_hotels = Hotels::GetAllActive();
            $arr_hotels = array();
            foreach ($total_hotels[0] as $key => $val) {
                $this->arrCompanies[$val['id']] = $val['name'];
            }
            $this->additionalFields = ', hotels';
            $this->accountTypeOnChange = 'onchange="javascript:AccountType_OnChange(this.value)"';
        }
        if ($objSettings->GetParameter('date_format') == 'mm/dd/yyyy') {
            $this->sqlFieldDatetimeFormat = '%b %d, %Y %H:%i';
        } else {
            $this->sqlFieldDatetimeFormat = '%d %b, %Y %H:%i';
        }
        $this->SetLocale(Application::Get('lc_time_name'));
        //----------------------------------------------------------------------
        // VIEW MODE
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
									first_name,
		                            last_name,
									CONCAT(first_name, \' \', last_name) as full_name,
									user_name,
									email,
									preferred_language,
									account_type,
									DATE_FORMAT(date_lastlogin, \'' . $this->sqlFieldDatetimeFormat . '\') as date_lastlogin,
									is_active
									' . $this->additionalFields . '
								FROM ' . $this->tableName;
        // define view mode fields
        $this->arrViewModeFields = array('full_name' => array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => ''), 'user_name' => array('title' => _USER_NAME, 'type' => 'label', 'align' => 'left', 'width' => ''), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'link', 'maxlength' => '35', 'href' => 'mailto:{email}', 'align' => 'left', 'width' => ''), 'account_type' => array('title' => _ACCOUNT_TYPE, 'type' => 'enum', 'align' => 'center', 'width' => '120px', 'sortable' => true, 'nowrap' => '', 'visible' => true, 'source' => $arr_account_types), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'align' => 'center', 'width' => '80px', 'sortable' => true, 'nowrap' => '', 'visible' => true, 'source' => $arr_is_active), 'date_lastlogin' => array('title' => _LAST_LOGIN, 'type' => 'label', 'align' => 'center', 'width' => '110px', 'format' => 'date', 'format_parameter' => $datetime_format), 'id' => array('title' => 'ID', 'type' => 'label', 'align' => 'center', 'width' => '40px'));
        //----------------------------------------------------------------------
        // ADD MODE
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array('separator_1' => array('separator_info' => array('legend' => _PERSONAL_DETAILS), 'first_name' => array('title' => _FIRST_NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'text'), 'last_name' => array('title' => _LAST_NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'text'), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '70', 'validation_type' => 'email', 'unique' => true)), 'separator_2' => array('separator_info' => array('legend' => _ACCOUNT_DETAILS), 'user_name' => array('title' => _USER_NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'alpha_numeric', 'unique' => true, 'username_generator' => true), 'password' => array('title' => _PASSWORD, 'type' => 'password', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'password', 'cryptography' => PASSWORDS_ENCRYPTION, 'cryptography_type' => PASSWORDS_ENCRYPTION_TYPE, 'aes_password' => PASSWORDS_ENCRYPT_KEY, 'password_generator' => true), 'account_type' => array('title' => _ACCOUNT_TYPE, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '120px', 'source' => $arr_account_types, 'javascript_event' => $this->accountTypeOnChange), 'preferred_language' => array('title' => _PREFERRED_LANGUAGE, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '120px', 'default' => Application::Get('lang'), 'source' => $arr_languages)), 'separator_3' => array('separator_info' => array('legend' => _OTHER), 'date_lastlogin' => array('title' => '', 'type' => 'hidden', 'required' => false, 'default' => ''), 'date_created' => array('title' => '', 'type' => 'hidden', 'required' => false, 'default' => date('Y-m-d H:i:s')), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'readonly' => false, 'default' => '1', 'true_value' => '1', 'false_value' => '0', 'unique' => false)));
        if (self::$PROJECT == 'HotelSite') {
            $this->arrAddModeFields['separator_3']['hotels'] = array('title' => _HOTELS, 'type' => 'enum', 'width' => '', 'required' => false, 'readonly' => false, 'default' => '', 'source' => $this->arrCompanies, 'default_option' => '', 'unique' => false, 'javascript_event' => '', 'view_type' => 'checkboxes', 'multi_select' => true);
        }
        //----------------------------------------------------------------------
        // EDIT MODE
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.first_name,
								' . $this->tableName . '.last_name,
								' . $this->tableName . '.user_name,
								' . $this->tableName . '.password,
								' . $this->tableName . '.email,
								' . $this->tableName . '.account_type,
								' . $this->tableName . '.preferred_language,
								DATE_FORMAT(' . $this->tableName . '.date_created, \'' . $this->sqlFieldDatetimeFormat . '\') as date_created,
								DATE_FORMAT(' . $this->tableName . '.date_lastlogin, \'' . $this->sqlFieldDatetimeFormat . '\') as date_lastlogin,
								' . $this->tableName . '.is_active
								' . $this->additionalFields . '
							FROM ' . $this->tableName . '
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('separator_1' => array('separator_info' => array('legend' => _PERSONAL_DETAILS), 'first_name' => array('title' => _FIRST_NAME, 'type' => 'textbox', 'width' => '210px', 'maxlength' => '32', 'required' => true, 'validation_type' => 'text'), 'last_name' => array('title' => _LAST_NAME, 'type' => 'textbox', 'width' => '210px', 'maxlength' => '32', 'required' => true, 'validation_type' => 'text'), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'textbox', 'width' => '210px', 'maxlength' => '70', 'required' => true, 'validation_type' => 'email', 'unique' => true)), 'separator_2' => array('separator_info' => array('legend' => _ACCOUNT_DETAILS), 'user_name' => array('title' => _USER_NAME, 'type' => 'textbox', 'width' => '210px', 'maxlength' => '32', 'required' => true, 'readonly' => true, 'validation_type' => 'alpha_numeric', 'unique' => true), 'account_type' => array('title' => _ACCOUNT_TYPE, 'type' => 'enum', 'width' => '120px', 'required' => true, 'maxlength' => '32', 'readonly' => $login_type == 'owner' ? false : true, 'source' => $arr_account_types, 'javascript_event' => $this->accountTypeOnChange), 'preferred_language' => array('title' => _PREFERRED_LANGUAGE, 'type' => 'enum', 'width' => '120px', 'required' => true, 'readonly' => false, 'source' => $arr_languages)), 'separator_3' => array('separator_info' => array('legend' => _OTHER), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'label'), 'date_lastlogin' => array('title' => _LAST_LOGIN, 'type' => 'label'), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'true_value' => '1', 'false_value' => '0')));
        if (self::$PROJECT == 'HotelSite') {
            $this->arrEditModeFields['separator_3']['hotels'] = array('title' => _HOTELS, 'type' => 'enum', 'width' => '', 'required' => false, 'readonly' => false, 'default' => '', 'source' => $this->arrCompanies, 'default_option' => '', 'unique' => false, 'javascript_event' => '', 'view_type' => 'checkboxes', 'multi_select' => true);
        }
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.first_name,
								' . $this->tableName . '.last_name,
								' . $this->tableName . '.user_name,
								' . $this->tableName . '.password,
								' . $this->tableName . '.email,
								' . $this->tableName . '.preferred_language,
								' . $this->tableName . '.account_type,
								DATE_FORMAT(' . $this->tableName . '.date_created, \'' . $this->sqlFieldDatetimeFormat . '\') as date_created,
								DATE_FORMAT(' . $this->tableName . '.date_lastlogin, \'' . $this->sqlFieldDatetimeFormat . '\') as date_lastlogin,
								' . $this->tableName . '.is_active
								' . $this->additionalFields . '
							FROM ' . $this->tableName . '
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        $this->arrDetailsModeFields = array('separator_1' => array('separator_info' => array('legend' => _PERSONAL_DETAILS), 'first_name' => array('title' => _FIRST_NAME, 'type' => 'label'), 'last_name' => array('title' => _LAST_NAME, 'type' => 'label'), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'label')), 'separator_2' => array('separator_info' => array('legend' => _ACCOUNT_DETAILS), 'user_name' => array('title' => _USER_NAME, 'type' => 'label'), 'account_type' => array('title' => _ACCOUNT_TYPE, 'type' => 'enum', 'source' => $arr_account_types), 'preferred_language' => array('title' => _PREFERRED_LANGUAGE, 'type' => 'enum', 'source' => $arr_languages)), 'separator_3' => array('separator_info' => array('legend' => _OTHER), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'label'), 'date_lastlogin' => array('title' => _LAST_LOGIN, 'type' => 'label'), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'source' => $arr_is_active)));
        if (self::$PROJECT == 'HotelSite') {
            $this->arrDetailsModeFields['separator_3']['hotels'] = array('title' => _HOTELS, 'type' => 'enum', 'width' => '', 'required' => false, 'readonly' => false, 'default' => '', 'source' => $this->arrCompanies, 'default_option' => '', 'unique' => false, 'javascript_event' => '', 'view_type' => 'checkboxes', 'multi_select' => true);
        }
    }
コード例 #25
0
ファイル: Customers.class.php プロジェクト: mozdial/Directory
    function __construct()
    {
        parent::__construct();
        $this->params = array();
        if (isset($_POST['group_id'])) {
            $this->params['group_id'] = (int) prepare_input($_POST['group_id']);
        }
        if (isset($_POST['first_name'])) {
            $this->params['first_name'] = prepare_input($_POST['first_name']);
        }
        if (isset($_POST['last_name'])) {
            $this->params['last_name'] = prepare_input($_POST['last_name']);
        }
        if (isset($_POST['birth_date']) && $_POST['birth_date'] != '') {
            $this->params['birth_date'] = prepare_input($_POST['birth_date']);
        } else {
            $this->params['birth_date'] = '0000-00-00';
        }
        if (isset($_POST['company'])) {
            $this->params['company'] = prepare_input($_POST['company']);
        }
        if (isset($_POST['b_address'])) {
            $this->params['b_address'] = prepare_input($_POST['b_address']);
        }
        if (isset($_POST['b_address_2'])) {
            $this->params['b_address_2'] = prepare_input($_POST['b_address_2']);
        }
        if (isset($_POST['b_city'])) {
            $this->params['b_city'] = prepare_input($_POST['b_city']);
        }
        if (isset($_POST['b_state'])) {
            $this->params['b_state'] = prepare_input($_POST['b_state']);
        }
        if (isset($_POST['b_country'])) {
            $this->params['b_country'] = prepare_input($_POST['b_country']);
        }
        if (isset($_POST['b_zipcode'])) {
            $this->params['b_zipcode'] = prepare_input($_POST['b_zipcode']);
        }
        if (isset($_POST['phone'])) {
            $this->params['phone'] = prepare_input($_POST['phone']);
        }
        if (isset($_POST['fax'])) {
            $this->params['fax'] = prepare_input($_POST['fax']);
        }
        if (isset($_POST['email'])) {
            $this->params['email'] = prepare_input($_POST['email']);
        }
        if (isset($_POST['url'])) {
            $this->params['url'] = prepare_input($_POST['url'], false, 'medium');
        }
        if (isset($_POST['user_name'])) {
            $this->params['user_name'] = prepare_input($_POST['user_name']);
        }
        if (isset($_POST['user_password'])) {
            $this->params['user_password'] = prepare_input($_POST['user_password']);
        }
        if (isset($_POST['preferred_language'])) {
            $this->params['preferred_language'] = prepare_input($_POST['preferred_language']);
        }
        if (isset($_POST['date_created'])) {
            $this->params['date_created'] = prepare_input($_POST['date_created']);
        }
        if (isset($_POST['date_lastlogin'])) {
            $this->params['date_lastlogin'] = prepare_input($_POST['date_lastlogin']);
        }
        if (isset($_POST['registered_from_ip'])) {
            $this->params['registered_from_ip'] = prepare_input($_POST['registered_from_ip']);
        }
        if (isset($_POST['last_logged_ip'])) {
            $this->params['last_logged_ip'] = prepare_input($_POST['last_logged_ip']);
        }
        if (isset($_POST['email_notifications'])) {
            $this->params['email_notifications'] = prepare_input($_POST['email_notifications']);
        } else {
            $this->params['email_notifications'] = '0';
        }
        if (isset($_POST['notification_status_changed'])) {
            $this->params['notification_status_changed'] = prepare_input($_POST['notification_status_changed']);
        }
        if (isset($_POST['is_active'])) {
            $this->params['is_active'] = (int) $_POST['is_active'];
        } else {
            $this->params['is_active'] = '0';
        }
        if (isset($_POST['is_removed'])) {
            $this->params['is_removed'] = (int) $_POST['is_removed'];
        } else {
            $this->params['is_removed'] = '0';
        }
        if (isset($_POST['comments'])) {
            $this->params['comments'] = prepare_input($_POST['comments']);
        }
        if (isset($_POST['registration_code'])) {
            $this->params['registration_code'] = prepare_input($_POST['registration_code']);
        }
        if (isset($_POST['plan1_listings'])) {
            $this->params['plan1_listings'] = prepare_input($_POST['plan1_listings']);
        }
        if (isset($_POST['plan2_listings'])) {
            $this->params['plan2_listings'] = prepare_input($_POST['plan2_listings']);
        }
        if (isset($_POST['plan3_listings'])) {
            $this->params['plan3_listings'] = prepare_input($_POST['plan3_listings']);
        }
        if (isset($_POST['plan4_listings'])) {
            $this->params['plan4_listings'] = prepare_input($_POST['plan4_listings']);
        }
        $rid = MicroGrid::GetParameter('rid');
        $action = MicroGrid::GetParameter('action');
        $this->email_notifications = '';
        $this->user_password = '';
        $this->allow_adding_by_admin = ModulesSettings::Get('customers', 'allow_adding_by_admin');
        $this->allow_changing_password = ModulesSettings::Get('customers', 'password_changing_by_admin');
        $this->reg_confirmation = ModulesSettings::Get('customers', 'reg_confirmation');
        $allow_adding = $this->allow_adding_by_admin == 'yes' ? true : false;
        $this->primaryKey = 'id';
        $this->tableName = TABLE_CUSTOMERS;
        $this->dataSet = array();
        $this->error = '';
        ///$this->languageId  	= (isset($_REQUEST['language_id']) && $_REQUEST['language_id'] != '') ? $_REQUEST['language_id'] : Languages::GetDefaultLang();
        $this->formActionURL = 'index.php?admin=mod_customers_management';
        $this->actions = array('add' => $allow_adding, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowTopButtons = true;
        $this->allowLanguages = false;
        $this->WHERE_CLAUSE = '';
        $this->ORDER_CLAUSE = 'ORDER BY id DESC';
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $total_countries = Countries::GetAllCountries('priority_order DESC, name ASC');
        $arr_countries = array();
        foreach ($total_countries[0] as $key => $val) {
            $arr_countries[$val['abbrv']] = $val['name'];
        }
        // prepare plans array
        $total_plans = AdvertisePlans::GetAllPlans();
        $arr_plans = array();
        foreach ($total_plans[0] as $key => $val) {
            $arr_plans[$val['id']] = $val['plan_name'];
        }
        // prepare groups array
        $total_groups = CustomerGroups::GetAllGroups();
        $arr_groups = array();
        foreach ($total_groups[0] as $key => $val) {
            $arr_groups[$val['id']] = $val['name'];
        }
        // prepare languages array
        $total_languages = Languages::GetAllActive();
        $arr_languages = array();
        foreach ($total_languages[0] as $key => $val) {
            $arr_languages[$val['abbreviation']] = $val['lang_name'];
        }
        $this->isFilteringAllowed = true;
        // define filtering fields
        $this->arrFilteringFields = array(_FIRST_NAME => array('table' => 'c', 'field' => 'first_name', 'type' => 'text', 'sign' => 'like%', 'width' => '80px'), _LAST_NAME => array('table' => 'c', 'field' => 'last_name', 'type' => 'text', 'sign' => 'like%', 'width' => '80px'), _EMAIL => array('table' => 'c', 'field' => 'email', 'type' => 'text', 'sign' => 'like%', 'width' => '90px'), _ACTIVE => array('table' => 'c', 'field' => 'is_active', 'type' => 'dropdownlist', 'source' => array('0' => _NO, '1' => _YES), 'sign' => '=', 'width' => '85px'), _GROUP => array('table' => 'c', 'field' => 'group_id', 'type' => 'dropdownlist', 'source' => $arr_groups, 'sign' => '=', 'width' => '85px'));
        $customer_ip = get_current_ip();
        $datetime_format = get_datetime_format();
        $date_format_view = get_date_format('view');
        $date_format_edit = get_date_format('edit');
        $default_plan_info = AdvertisePlans::GetDefaultPlanInfo();
        $default_plan_id = isset($default_plan_info['id']) ? (int) $default_plan_info['id'] : 0;
        $default_plan_lc = isset($default_plan_info['listings_count']) ? (int) $default_plan_info['listings_count'] : 0;
        //----------------------------------------------------------------------
        // VIEW MODE
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT
									c.' . $this->primaryKey . ',
		                            c.*,
									CONCAT(c.first_name, " ", c.last_name) as full_name,
									IF(c.is_active, "<span class=yes>' . _YES . '</span>", "<span class=no>' . _NO . '</span>") as customer_active,
									cg.name as group_name
								FROM ' . $this->tableName . ' c
									LEFT OUTER JOIN ' . TABLE_CUSTOMER_GROUPS . ' cg ON c.group_id = cg.id ';
        // define view mode fields
        $this->arrViewModeFields = array('full_name' => array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => '', 'maxlength' => '20'), 'user_name' => array('title' => _USERNAME, 'type' => 'label', 'align' => 'left', 'width' => '', 'maxlength' => '20'), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'link', 'href' => 'mailto:{email}', 'align' => 'left', 'width' => '', 'maxlength' => '36'), 'b_country' => array('title' => _COUNTRY, 'type' => 'enum', 'align' => 'left', 'width' => '', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'source' => $arr_countries), 'customer_active' => array('title' => _ACTIVE, 'type' => 'label', 'align' => 'center', 'width' => '90px'), 'group_name' => array('title' => _GROUP, 'type' => 'label', 'align' => 'left', 'width' => '90px'), 'id' => array('title' => 'ID', 'type' => 'label', 'align' => 'center', 'width' => '50px'));
        //----------------------------------------------------------------------
        // ADD MODE
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array('separator_1' => array('separator_info' => array('legend' => _PERSONAL_DETAILS), 'first_name' => array('title' => _FIRST_NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'text'), 'last_name' => array('title' => _LAST_NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'text'), 'birth_date' => array('title' => _BIRTH_DATE, 'type' => 'date', 'width' => '210px', 'required' => false, 'readonly' => false, 'default' => '', 'validation_type' => 'date', 'unique' => false, 'visible' => true, 'min_year' => '90', 'max_year' => '0', 'format' => 'date', 'format_parameter' => $date_format_edit), 'url' => array('title' => _URL, 'type' => 'textbox', 'width' => '270px', 'required' => false, 'maxlength' => '255', 'validation_type' => 'text')), 'separator_2' => array('separator_info' => array('legend' => _BILLING_ADDRESS), 'company' => array('title' => _COMPANY, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '128', 'validation_type' => 'text'), 'b_address' => array('title' => _ADDRESS, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '64', 'validation_type' => 'text'), 'b_address_2' => array('title' => _ADDRESS_2, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '64', 'validation_type' => 'text'), 'b_city' => array('title' => _CITY, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '64', 'validation_type' => 'text'), 'b_zipcode' => array('title' => _ZIP_CODE, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'text'), 'b_country' => array('title' => _COUNTRY, 'type' => 'enum', 'width' => '', 'source' => $arr_countries, 'required' => true), 'b_state' => array('title' => _STATE_PROVINCE, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '64', 'validation_type' => 'text')), 'separator_3' => array('separator_info' => array('legend' => _CONTACT_INFORMATION), 'phone' => array('title' => _PHONE, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '32', 'validation_type' => 'text'), 'fax' => array('title' => _FAX, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '32', 'validation_type' => 'text'), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'textbox', 'width' => '230px', 'required' => false, 'maxlength' => '70', 'validation_type' => 'email', 'unique' => true, 'autocomplete' => 'off')), 'separator_4' => array('separator_info' => array('legend' => _ACCOUNT_DETAILS), 'user_name' => array('title' => _USERNAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'validation_type' => 'text', 'maxlength' => '32', 'validation_minlength' => '4', 'readonly' => false, 'unique' => true), 'user_password' => array('title' => _PASSWORD, 'type' => 'password', 'width' => '210px', 'required' => true, 'validation_type' => 'password', 'maxlength' => '20', 'cryptography' => PASSWORDS_ENCRYPTION, 'cryptography_type' => PASSWORDS_ENCRYPTION_TYPE, 'aes_password' => PASSWORDS_ENCRYPT_KEY), 'group_id' => array('title' => _CUSTOMER_GROUP, 'type' => 'enum', 'required' => false, 'readonly' => false, 'width' => '', 'source' => $arr_groups), 'preferred_language' => array('title' => _PREFERRED_LANGUAGE, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '120px', 'default' => Application::Get('lang'), 'source' => $arr_languages)), 'separator_5' => array('separator_info' => array('legend' => _OTHER), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'hidden', 'width' => '210px', 'required' => true, 'default' => date('Y-m-d H:i:s')), 'registered_from_ip' => array('title' => _REGISTERED_FROM_IP, 'type' => 'hidden', 'width' => '210px', 'required' => true, 'default' => $customer_ip), 'last_logged_ip' => array('title' => _LAST_LOGGED_IP, 'type' => 'hidden', 'width' => '210px', 'required' => false, 'default' => ''), 'email_notifications' => array('title' => _EMAIL_NOTIFICATION, 'type' => 'checkbox', 'true_value' => '1', 'false_value' => '0'), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'readonly' => false, 'default' => '1', 'true_value' => '1', 'false_value' => '0', 'unique' => false), 'is_removed' => array('title' => _REMOVED, 'type' => 'hidden', 'width' => '210px', 'required' => true, 'default' => '0'), 'comments' => array('title' => _COMMENTS, 'type' => 'textarea', 'width' => '420px', 'height' => '70px', 'required' => false, 'readonly' => false, 'validation_type' => 'text', 'validation_maxlength' => '2048'), 'registration_code' => array('title' => _REGISTRATION_CODE, 'type' => 'hidden', 'width' => '210px', 'required' => false, 'default' => ''), 'plan1_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[1], 'type' => 'hidden', 'width' => '210px', 'required' => true, 'default' => $default_plan_id == '1' ? (int) $default_plan_lc : '0'), 'plan2_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[2], 'type' => 'hidden', 'width' => '210px', 'required' => true, 'default' => $default_plan_id == '2' ? (int) $default_plan_lc : '0'), 'plan3_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[3], 'type' => 'hidden', 'width' => '210px', 'required' => true, 'default' => $default_plan_id == '3' ? (int) $default_plan_lc : '0'), 'plan4_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[4], 'type' => 'hidden', 'width' => '210px', 'required' => true, 'default' => $default_plan_id == '4' ? (int) $default_plan_lc : '0')));
        //----------------------------------------------------------------------
        // EDIT MODE
        // * password field must be written directly in SQL!!!
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
									' . $this->tableName . '.' . $this->primaryKey . ',
		                            ' . $this->tableName . '.*,
									' . $this->tableName . '.user_password,
									' . $this->tableName . '.date_created,
									' . $this->tableName . '.date_lastlogin,
									' . $this->tableName . '.notification_status_changed
								FROM ' . $this->tableName . '
								WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('separator_1' => array('separator_info' => array('legend' => _PERSONAL_DETAILS), 'first_name' => array('title' => _FIRST_NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'text'), 'last_name' => array('title' => _LAST_NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'text'), 'birth_date' => array('title' => _BIRTH_DATE, 'type' => 'date', 'width' => '210px', 'required' => false, 'readonly' => false, 'default' => '', 'validation_type' => 'date', 'unique' => false, 'visible' => true, 'min_year' => '90', 'max_year' => '0', 'format' => 'date', 'format_parameter' => $date_format_edit), 'url' => array('title' => _URL, 'type' => 'textbox', 'width' => '270px', 'required' => false, 'maxlength' => '255', 'validation_type' => 'text')), 'separator_2' => array('separator_info' => array('legend' => _BILLING_ADDRESS), 'company' => array('title' => _COMPANY, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '128', 'validation_type' => 'text'), 'b_address' => array('title' => _ADDRESS, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '64', 'validation_type' => 'text'), 'b_address_2' => array('title' => _ADDRESS_2, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '64', 'validation_type' => 'text'), 'b_city' => array('title' => _CITY, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '64', 'validation_type' => 'text'), 'b_zipcode' => array('title' => _ZIP_CODE, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'text'), 'b_country' => array('title' => _COUNTRY, 'type' => 'enum', 'width' => '', 'source' => $arr_countries, 'required' => true), 'b_state' => array('title' => _STATE_PROVINCE, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '64', 'validation_type' => 'text')), 'separator_3' => array('separator_info' => array('legend' => _CONTACT_INFORMATION), 'phone' => array('title' => _PHONE, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '32', 'validation_type' => 'text'), 'fax' => array('title' => _FAX, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '32', 'validation_type' => 'text'), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'textbox', 'width' => '230px', 'required' => true, 'maxlength' => '70', 'readonly' => false, 'validation_type' => 'email', 'unique' => true, 'autocomplete' => 'off')), 'separator_4' => array('separator_info' => array('legend' => _ACCOUNT_DETAILS), 'user_name' => array('title' => _USERNAME, 'type' => 'label'), 'user_password' => array('title' => _PASSWORD, 'type' => 'password', 'width' => '210px', 'maxlength' => '20', 'required' => true, 'validation_type' => 'password', 'cryptography' => PASSWORDS_ENCRYPTION, 'cryptography_type' => PASSWORDS_ENCRYPTION_TYPE, 'aes_password' => PASSWORDS_ENCRYPT_KEY, 'visible' => $this->allow_changing_password == 'yes' ? true : false), 'group_id' => array('title' => _CUSTOMER_GROUP, 'type' => 'enum', 'required' => false, 'readonly' => false, 'width' => '', 'source' => $arr_groups), 'preferred_language' => array('title' => _PREFERRED_LANGUAGE, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '120px', 'source' => $arr_languages)), 'separator_5' => array('separator_info' => array('legend' => _OTHER), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'date_lastlogin' => array('title' => _LAST_LOGIN, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'registered_from_ip' => array('title' => _REGISTERED_FROM_IP, 'type' => 'label'), 'last_logged_ip' => array('title' => _LAST_LOGGED_IP, 'type' => 'label'), 'email_notifications' => array('title' => _EMAIL_NOTIFICATION, 'type' => 'checkbox', 'true_value' => '1', 'false_value' => '0'), 'notification_status_changed' => array('title' => _NOTIFICATION_STATUS_CHANGED, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'true_value' => '1', 'false_value' => '0'), 'is_removed' => array('title' => _REMOVED, 'type' => 'checkbox', 'true_value' => '1', 'false_value' => '0'), 'comments' => array('title' => _COMMENTS, 'type' => 'textarea', 'width' => '420px', 'height' => '70px', 'required' => false, 'readonly' => false, 'validation_type' => 'text', 'validation_maxlength' => '2048'), 'registration_code' => array('title' => _REGISTRATION_CODE, 'type' => 'hidden', 'width' => '210px', 'required' => false, 'default' => '')), 'separator_6' => array('separator_info' => array('legend' => _LISTINGS), 'orders_count' => array('title' => _ORDERS_COUNT, 'type' => 'label'), 'plan1_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[1], 'type' => 'label'), 'plan2_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[2], 'type' => 'label'), 'plan3_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[3], 'type' => 'label'), 'plan4_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[4], 'type' => 'label')));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = 'SELECT
									c.' . $this->primaryKey . ',
		                            c.*,
									IF(c.email_notifications, "<span class=yes>' . _YES . '</span>", "<span class=no>' . _NO . '</span>") as email_notifications,
									IF(c.is_active, "<span class=yes>' . _YES . '</span>", "<span class=no>' . _NO . '</span>") as customer_active,
									IF(c.is_removed, "<span class=yes>' . _YES . '</span>", "<span class=no>' . _NO . '</span>") as customer_removed,
									c.date_created,
									c.date_lastlogin,
									c.notification_status_changed,
									cg.name as group_name
								FROM ' . $this->tableName . ' c
									LEFT OUTER JOIN ' . TABLE_CUSTOMER_GROUPS . ' cg ON c.group_id = cg.id
								WHERE c.' . $this->primaryKey . ' = _RID_';
        $this->arrDetailsModeFields = array('separator_1' => array('separator_info' => array('legend' => _PERSONAL_DETAILS), 'first_name' => array('title' => _FIRST_NAME, 'type' => 'label'), 'last_name' => array('title' => _LAST_NAME, 'type' => 'label'), 'birth_date' => array('title' => _BIRTH_DATE, 'type' => 'date', 'format' => 'date', 'format_parameter' => $date_format_view), 'url' => array('title' => _URL, 'type' => 'label')), 'separator_2' => array('separator_info' => array('legend' => _BILLING_ADDRESS), 'company' => array('title' => _COMPANY, 'type' => 'label'), 'b_address' => array('title' => _ADDRESS, 'type' => 'label'), 'b_address_2' => array('title' => _ADDRESS_2, 'type' => 'label'), 'b_city' => array('title' => _CITY, 'type' => 'label'), 'b_zipcode' => array('title' => _ZIP_CODE, 'type' => 'label'), 'b_country' => array('title' => _COUNTRY, 'type' => 'enum', 'source' => $arr_countries), 'b_state' => array('title' => _STATE_PROVINCE, 'type' => 'label')), 'separator_3' => array('separator_info' => array('legend' => _CONTACT_INFORMATION), 'phone' => array('title' => _PHONE, 'type' => 'label'), 'fax' => array('title' => _FAX, 'type' => 'label'), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'label')), 'separator_4' => array('separator_info' => array('legend' => _ACCOUNT_DETAILS), 'user_name' => array('title' => _USERNAME, 'type' => 'label'), 'group_name' => array('title' => _CUSTOMER_GROUP, 'type' => 'label'), 'preferred_language' => array('title' => _PREFERRED_LANGUAGE, 'type' => 'enum', 'source' => $arr_languages)), 'separator_5' => array('separator_info' => array('legend' => _OTHER), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'date_lastlogin' => array('title' => _LAST_LOGIN, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'registered_from_ip' => array('title' => _REGISTERED_FROM_IP, 'type' => 'label'), 'last_logged_ip' => array('title' => _LAST_LOGGED_IP, 'type' => 'label'), 'email_notifications' => array('title' => _EMAIL_NOTIFICATION, 'type' => 'label'), 'notification_status_changed' => array('title' => _NOTIFICATION_STATUS_CHANGED, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'customer_active' => array('title' => _ACTIVE, 'type' => 'label'), 'customer_removed' => array('title' => _REMOVED, 'type' => 'label'), 'comments' => array('title' => _COMMENTS, 'type' => 'label')), 'separator_6' => array('separator_info' => array('legend' => _LISTINGS), 'orders_count' => array('title' => _ORDERS_COUNT, 'type' => 'label'), 'plan1_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[1], 'type' => 'label'), 'plan2_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[2], 'type' => 'label'), 'plan3_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[3], 'type' => 'label'), 'plan4_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[4], 'type' => 'label')));
    }
コード例 #26
0
    function __construct()
    {
        parent::__construct();
        $this->params = array();
        if (isset($_POST['name'])) {
            $this->params['name'] = prepare_input($_POST['name']);
        }
        if (isset($_POST['symbol'])) {
            $this->params['symbol'] = prepare_input($_POST['symbol']);
        }
        if (isset($_POST['symbol_placement'])) {
            $this->params['symbol_placement'] = prepare_input($_POST['symbol_placement']);
        }
        if (isset($_POST['code'])) {
            $this->params['code'] = prepare_input($_POST['code']);
        }
        if (isset($_POST['rate'])) {
            $this->params['rate'] = prepare_input($_POST['rate']);
        }
        if (isset($_POST['decimals'])) {
            $this->params['decimals'] = prepare_input($_POST['decimals']);
        }
        if (isset($_POST['primary_order'])) {
            $this->params['primary_order'] = (int) $_POST['primary_order'];
        }
        // for checkboxes
        if (isset($_POST['is_default'])) {
            $this->params['is_default'] = (int) $_POST['is_default'];
        } else {
            $this->params['is_default'] = '0';
        }
        if (isset($_POST['is_active'])) {
            $this->params['is_active'] = (int) $_POST['is_active'];
        } else {
            $this->params['is_active'] = '0';
        }
        $this->params['language_id'] = MicroGrid::GetParameter('language_id');
        $this->primaryKey = 'id';
        $this->tableName = TABLE_CURRENCIES;
        $this->dataSet = array();
        $this->error = '';
        if (self::$PROJECT == 'HotelSite') {
            $this->formActionURL = 'index.php?admin=mod_booking_currencies';
        } else {
            if (self::$PROJECT == 'ShoppingCart') {
                $this->formActionURL = 'index.php?admin=mod_catalog_currencies';
            } else {
                if (self::$PROJECT == 'BusinessDirectory') {
                    $this->formActionURL = 'index.php?admin=mod_payments_currencies';
                } else {
                    if (self::$PROJECT == 'MedicalAppointments') {
                        $this->formActionURL = 'index.php?admin=mod_appointments_currencies';
                    }
                }
            }
        }
        $this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowLanguages = false;
        $this->languageId = '';
        // ($this->params['language_id'] != '') ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = '';
        // WHERE .... / 'WHERE language_id = \''.$this->languageId.'\'';
        $this->ORDER_CLAUSE = 'ORDER BY ' . $this->tableName . '.primary_order ASC';
        // ORDER BY date_created DESC
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isFilteringAllowed = false;
        // define filtering fields
        ///$this->arrFilteringFields = array(
        ///	'parameter1' => array('title'=>'',  'type'=>'text', 'sign'=>'=|like%|%like|%like%', 'width'=>'80px'),
        ///	'parameter2'  => array('title'=>'',  'type'=>'text', 'sign'=>'=|like%|%like|%like%', 'width'=>'80px'),
        ///);
        $currency_format = get_currency_format();
        $arr_is_active = array('0' => '<span class=no>' . _NO . '</span>', '1' => '<span class=yes>' . _YES . '</span>');
        $arr_is_default = array('0' => '<span class=gray>' . _NO . '</span>', '1' => '<span class=yes>' . _YES . '</span>');
        $arr_decimals = array('0' => '0', '1' => '1', '2' => '2');
        $arr_symbol_placement = array('left' => _LEFT, 'right' => _RIGHT);
        // prepare languages array
        /// $total_languages = Languages::GetAllActive();
        /// $arr_languages      = array();
        /// foreach($total_languages[0] as $key => $val){
        /// 	$arr_languages[$val['abbreviation']] = $val['lang_name'];
        /// }
        //----------------------------------------------------------------------
        // VIEW MODE
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
									name,
									symbol,
									symbol_placement,
									code,
									rate,
									decimals,
									primary_order,
									is_default,
									is_active
								FROM ' . $this->tableName;
        // define view mode fields
        $this->arrViewModeFields = array('name' => array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => '', 'height' => '', 'maxlength' => ''), 'symbol' => array('title' => _SYMBOL, 'type' => 'label', 'align' => 'center', 'width' => '90px', 'height' => '', 'maxlength' => ''), 'code' => array('title' => _CODE, 'type' => 'label', 'align' => 'center', 'width' => '90px', 'height' => '', 'maxlength' => ''), 'rate' => array('title' => _RATE, 'type' => 'label', 'align' => 'center', 'width' => '90px', 'height' => '', 'maxlength' => '', 'format' => 'currency', 'format_parameter' => $currency_format . '|4'), 'decimals' => array('title' => _DECIMALS, 'type' => 'label', 'align' => 'center', 'width' => '80px', 'height' => '', 'maxlength' => ''), 'primary_order' => array('title' => _ORDER, 'type' => 'label', 'align' => 'center', 'width' => '80px', 'height' => '', 'maxlength' => '', 'movable' => true), 'is_default' => array('title' => _DEFAULT, 'type' => 'enum', 'align' => 'center', 'width' => '80px', 'sortable' => true, 'nowrap' => '', 'visible' => true, 'source' => $arr_is_default), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'align' => 'center', 'width' => '80px', 'sortable' => true, 'nowrap' => '', 'visible' => true, 'source' => $arr_is_active));
        //----------------------------------------------------------------------
        // ADD MODE
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array('name' => array('title' => _NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'maxlength' => '50', 'validation_type' => 'text'), 'symbol' => array('title' => _SYMBOL, 'type' => 'textbox', 'width' => '50px', 'required' => true, 'readonly' => false, 'maxlength' => '5', 'validation_type' => 'text'), 'symbol_placement' => array('title' => _SYMBOL_PLACEMENT, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '100px', 'source' => $arr_symbol_placement), 'code' => array('title' => _CODE, 'type' => 'textbox', 'width' => '50px', 'required' => true, 'readonly' => false, 'maxlength' => '3', 'validation_type' => 'alpha'), 'rate' => array('title' => _RATE, 'type' => 'textbox', 'width' => '80px', 'required' => true, 'readonly' => false, 'maxlength' => '10', 'validation_type' => 'float', 'validation_maximum' => '999999'), 'decimals' => array('title' => _DECIMALS, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '80px', 'source' => $arr_decimals, 'default' => '2'), 'primary_order' => array('title' => _ORDER, 'type' => 'textbox', 'width' => '40px', 'required' => true, 'readonly' => false, 'maxlength' => '2', 'validation_type' => 'numeric'), 'is_default' => array('title' => _DEFAULT, 'type' => 'checkbox', 'readonly' => false, 'default' => '0', 'true_value' => '1', 'false_value' => '0'), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'readonly' => false, 'default' => '1', 'true_value' => '1', 'false_value' => '0'));
        //----------------------------------------------------------------------
        // EDIT MODE
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
									name,
									symbol,
									symbol_placement,
									code,
									rate,
									decimals,
									primary_order,
									is_default,
									is_active
							FROM ' . $this->tableName . '
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        $rid = MicroGrid::GetParameter('rid');
        $sql = 'SELECT is_default FROM ' . TABLE_CURRENCIES . ' WHERE id = ' . (int) $rid;
        $readonly = false;
        if ($result = database_query($sql, DATA_ONLY, FIRST_ROW_ONLY)) {
            $readonly = isset($result['is_default']) && $result['is_default'] == '1' ? true : false;
        }
        // define edit mode fields
        $this->arrEditModeFields = array('name' => array('title' => _NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'maxlength' => '50', 'validation_type' => 'text'), 'symbol' => array('title' => _SYMBOL, 'type' => 'textbox', 'width' => '50px', 'required' => true, 'readonly' => false, 'maxlength' => '5', 'validation_type' => 'text'), 'symbol_placement' => array('title' => _SYMBOL_PLACEMENT, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '100px', 'source' => $arr_symbol_placement), 'code' => array('title' => _CODE, 'type' => 'textbox', 'width' => '50px', 'required' => true, 'readonly' => false, 'maxlength' => '3', 'validation_type' => 'alpha'), 'rate' => array('title' => _RATE, 'type' => 'textbox', 'width' => '80px', 'required' => true, 'readonly' => $readonly, 'maxlength' => '10', 'validation_type' => 'float', 'validation_maximum' => '999999'), 'decimals' => array('title' => _DECIMALS, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '80px', 'source' => $arr_decimals), 'primary_order' => array('title' => _ORDER, 'type' => 'textbox', 'width' => '40px', 'required' => true, 'readonly' => false, 'maxlength' => '2', 'validation_type' => 'numeric'), 'is_default' => array('title' => _DEFAULT, 'type' => 'checkbox', 'readonly' => $readonly, 'default' => '0', 'true_value' => '1', 'false_value' => '0'), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'readonly' => $readonly, 'default' => '1', 'true_value' => '1', 'false_value' => '0'));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('name' => array('title' => _NAME, 'type' => 'label'), 'symbol' => array('title' => _SYMBOL, 'type' => 'label'), 'symbol_placement' => array('title' => _SYMBOL_PLACEMENT, 'type' => 'label'), 'code' => array('title' => _CODE, 'type' => 'label'), 'rate' => array('title' => _RATE, 'type' => 'label', 'format' => 'currency', 'format_parameter' => $currency_format . '|4'), 'decimals' => array('title' => _DECIMALS, 'type' => 'enum', 'source' => $arr_decimals), 'primary_order' => array('title' => _ORDER, 'type' => 'label'), 'is_default' => array('title' => _DEFAULT, 'type' => 'enum', 'source' => $arr_is_default), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'source' => $arr_is_active));
    }
コード例 #27
0
    function __construct()
    {
        parent::__construct();
        $this->params = array();
        ## for standard fields
        if (isset($_POST['name'])) {
            $this->params['name'] = prepare_input($_POST['name']);
        }
        if (isset($_POST['priority_order'])) {
            $this->params['priority_order'] = prepare_input($_POST['priority_order']);
        }
        ## for checkboxes
        $this->params['is_active'] = isset($_POST['is_active']) ? prepare_input($_POST['is_active']) : '0';
        ## for images (not necessary)
        //if(isset($_POST['icon'])){
        //	$this->params['icon'] = prepare_input($_POST['icon']);
        //}else if(isset($_FILES['icon']['name']) && $_FILES['icon']['name'] != ''){
        //	// nothing
        //}else if (self::GetParameter('action') == 'create'){
        //	$this->params['icon'] = '';
        //}
        ## for files:
        // define nothing
        ///$this->params['language_id'] = MicroGrid::GetParameter('language_id');
        //$this->uPrefix 		= 'prefix_';
        $this->primaryKey = 'id';
        $this->tableName = TABLE_FAQ_CATEGORIES;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=mod_faq_management';
        $this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowTopButtons = false;
        $this->alertOnDelete = '';
        // leave empty to use default alerts
        $this->allowLanguages = false;
        $this->languageId = '';
        // ($this->params['language_id'] != '') ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = '';
        // WHERE .... / 'WHERE language_id = \''.$this->languageId.'\'';
        $this->ORDER_CLAUSE = 'ORDER BY ' . $this->tableName . '.priority_order ASC';
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isExportingAllowed = false;
        $this->arrExportingTypes = array('csv' => false);
        $this->isFilteringAllowed = false;
        // define filtering fields
        $this->arrFilteringFields = array();
        $arr_is_active = array('0' => '<span class=no>' . _NO . '</span>', '1' => '<span class=yes>' . _YES . '</span>');
        ///$date_format = get_date_format('view');
        ///$date_format_edit = get_date_format('edit');
        ///$currency_format = get_currency_format();
        // prepare languages array
        /// $total_languages = Languages::GetAllActive();
        /// $arr_languages      = array();
        /// foreach($total_languages[0] as $key => $val){
        /// 	$arr_languages[$val['abbreviation']] = $val['lang_name'];
        /// }
        ///////////////////////////////////////////////////////////////////////////////
        // #002. prepare translation fields array
        /// $this->arrTranslations = $this->PrepareTranslateFields(
        ///	array('field1', 'field2')
        /// );
        ///////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////
        // #003. prepare translations array for add/edit/detail modes
        /// $sql_translation_description = $this->PrepareTranslateSql(
        ///	TABLE_XXX_DESCRIPTION,
        ///	'gallery_album_id',
        ///	array('field1', 'field2')
        /// );
        ///////////////////////////////////////////////////////////////////////////////
        //----------------------------------------------------------------------
        // VIEW MODE
        // format: strip_tags
        // format: nl2br
        // format: 'format'=>'date', 'format_parameter'=>'M d, Y, g:i A'
        // format: 'format'=>'currency', 'format_parameter'=>'european|2' or 'format_parameter'=>'american|4'
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
									name,
									priority_order,
									is_active,
									CONCAT(\'<a href="index.php?admin=mod_faq_questions_management&fcid=\', id, \'">' . _QUESTIONS . '</a> (\', (SELECT COUNT(*) as cnt FROM ' . TABLE_FAQ_CATEGORY_ITEMS . ' fci WHERE fci.category_id = ' . $this->tableName . '.id), \')\') as link_faq_category_items
								FROM ' . $this->tableName;
        // define view mode fields
        $this->arrViewModeFields = array('name' => array('title' => _CATEGORY, 'type' => 'label', 'align' => 'left', 'width' => '', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'tooltip' => '', 'maxlength' => '70', 'format' => '', 'format_parameter' => ''), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'align' => 'center', 'width' => '90px', 'sortable' => true, 'nowrap' => '', 'visible' => true, 'source' => $arr_is_active), 'priority_order' => array('title' => _ORDER, 'type' => 'label', 'align' => 'center', 'width' => '90px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'tooltip' => '', 'maxlength' => '', 'format' => '', 'format_parameter' => '', 'movable' => true), 'link_faq_category_items' => array('title' => _ITEMS, 'type' => 'label', 'align' => 'center', 'width' => '130px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'tooltip' => '', 'maxlength' => '', 'format' => '', 'format_parameter' => ''));
        //----------------------------------------------------------------------
        // ADD MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address|password|date
        // 	 Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255... Ex.: 'validation_maxlength'=>'255'
        // - Validation Min Length: 4, 6... Ex.: 'validation_minlength'=>'4'
        // - Validation Max Value: 12, 255... Ex.: 'validation_maximum'=>'99.99'
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array('name' => array('title' => _CATEGORY, 'type' => 'textbox', 'width' => '310px', 'required' => true, 'readonly' => false, 'maxlength' => '255', 'default' => '', 'validation_type' => '', 'unique' => false, 'visible' => true), 'priority_order' => array('title' => _ORDER, 'type' => 'textbox', 'width' => '50px', 'required' => true, 'readonly' => false, 'maxlength' => '3', 'default' => '0', 'validation_type' => 'numeric|positive', 'unique' => false, 'visible' => true), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'readonly' => false, 'default' => '1', 'true_value' => '1', 'false_value' => '0', 'unique' => false));
        //----------------------------------------------------------------------
        // EDIT MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address|password|date
        //   Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255... Ex.: 'validation_maxlength'=>'255'
        // - Validation Min Length: 4, 6... Ex.: 'validation_minlength'=>'4'
        // - Validation Max Value: 12, 255... Ex.: 'validation_maximum'=>'99.99'
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->primaryKey . ',
								name,
								priority_order,
								is_active								
							FROM ' . $this->tableName . '
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('name' => array('title' => _CATEGORY, 'type' => 'textbox', 'width' => '310px', 'required' => true, 'readonly' => false, 'maxlength' => '255', 'default' => '', 'validation_type' => '', 'unique' => false, 'visible' => true), 'priority_order' => array('title' => _ORDER, 'type' => 'textbox', 'width' => '50px', 'required' => true, 'readonly' => false, 'maxlength' => '3', 'default' => '0', 'validation_type' => 'numeric|positive', 'unique' => false, 'visible' => true), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'readonly' => false, 'default' => '1', 'true_value' => '1', 'false_value' => '0', 'unique' => false));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('name' => array('title' => _CATEGORY, 'type' => 'label'), 'priority_order' => array('title' => _ORDER, 'type' => 'label'), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'source' => $arr_is_active));
        ///////////////////////////////////////////////////////////////////////////////
        // #004. add translation fields to all modes
        /// $this->AddTranslateToModes(
        /// $this->arrTranslations,
        /// array('name'        => array('title'=>_NAME, 'type'=>'textbox', 'width'=>'410px', 'required'=>true, 'maxlength'=>'', 'readonly'=>false),
        /// 	  'description' => array('title'=>_DESCRIPTION, 'type'=>'textarea', 'width'=>'410px', 'height'=>'90px', 'required'=>false, 'readonly'=>false)
        /// )
        /// );
        ///////////////////////////////////////////////////////////////////////////////
    }
コード例 #28
0
    function __construct()
    {
        parent::__construct();
        $cid = isset($_GET['cid']) ? (int) $_GET['cid'] : '0';
        $cdid = isset($_GET['cdid']) ? (int) $_GET['cdid'] : '0';
        $this->params = array();
        if (isset($_POST['name'])) {
            $this->params['name'] = prepare_input($_POST['name']);
        }
        if (isset($_POST['description'])) {
            $this->params['description'] = prepare_input($_POST['description']);
        }
        //$default_lang = Languages::GetDefaultLang();
        // for checkboxes
        /// if(isset($_POST['parameter4']))   $this->params['parameter4'] = $_POST['parameter4']; else $this->params['parameter4'] = '0';
        //$this->params['language_id'] 	  = MicroGrid::GetParameter('language_id');
        $this->primaryKey = 'id';
        $this->tableName = TABLE_CATEGORIES_DESCRIPTION;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=mod_categories_description&cid=' . (int) $cid . '&cdid=' . (int) $cdid;
        $this->actions = array('add' => false, 'edit' => true, 'details' => true, 'delete' => false);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->isHtmlEncoding = true;
        $this->allowLanguages = false;
        $this->languageId = '';
        //($this->params['language_id'] != '') ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = 'WHERE ' . $this->tableName . '.category_id = \'' . $cdid . '\'';
        $this->ORDER_CLAUSE = 'ORDER BY ' . $this->tableName . '.id ASC';
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = false;
        $this->pageSize = 100;
        $this->isSortingAllowed = true;
        $this->isFilteringAllowed = false;
        // define filtering fields
        $this->arrFilteringFields = array('price' => array('title' => _CATEGORY, 'type' => 'text', 'sign' => 'like%', 'width' => '80px'));
        // prepare languages array
        //$total_languages = Languages::GetAllActive();
        //$arr_languages      = array();
        //foreach($total_languages[0] as $key => $val){
        //	$arr_languages[$val['abbreviation']] = $val['lang_name'];
        //}
        //----------------------------------------------------------------------
        // VIEW MODE
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->tableName . '.' . $this->primaryKey . ',
									' . $this->tableName . '.category_id,
									' . $this->tableName . '.language_id,
									' . $this->tableName . '.name,									
									' . $this->tableName . '.description,
									' . TABLE_LANGUAGES . '.lang_name  
								FROM ' . $this->tableName . '
									INNER JOIN ' . TABLE_CATEGORIES . ' ON ' . $this->tableName . '.category_id = ' . TABLE_CATEGORIES . '.id
									INNER JOIN ' . TABLE_LANGUAGES . ' ON ' . $this->tableName . '.language_id = ' . TABLE_LANGUAGES . '.abbreviation AND ' . TABLE_LANGUAGES . '.is_active = 1
								';
        // define view mode fields
        $this->arrViewModeFields = array('name' => array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => '200px', 'maxlength' => ''), 'description' => array('title' => _DESCRIPTION, 'type' => 'label', 'align' => 'left', 'width' => '', 'maxlength' => '50'), 'lang_name' => array('title' => _LANGUAGE, 'type' => 'label', 'align' => 'center', 'width' => '120px', 'maxlength' => ''));
        //----------------------------------------------------------------------
        // ADD MODE
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array();
        //----------------------------------------------------------------------
        // EDIT MODE
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT ' . $this->tableName . '.' . $this->primaryKey . ',
									' . $this->tableName . '.category_id,
									' . $this->tableName . '.language_id,
									' . $this->tableName . '.name,									
									' . $this->tableName . '.description,
									' . TABLE_LANGUAGES . '.lang_name  
								FROM ' . $this->tableName . '
									INNER JOIN ' . TABLE_CATEGORIES . ' ON ' . $this->tableName . '.category_id = ' . TABLE_CATEGORIES . '.id
									INNER JOIN ' . TABLE_LANGUAGES . ' ON ' . $this->tableName . '.language_id = ' . TABLE_LANGUAGES . '.abbreviation AND ' . TABLE_LANGUAGES . '.is_active = 1
								WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('lang_name' => array('title' => _LANGUAGE, 'type' => 'label'), 'name' => array('title' => _NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'default' => '', 'validation_type' => 'text', 'maxlength' => '50'), 'description' => array('title' => _DESCRIPTION, 'type' => 'textarea', 'width' => '400px', 'height' => '100px', 'required' => false, 'readonly' => false, 'default' => '', 'validation_type' => 'text', 'validation_maxlength' => '255'));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('lang_name' => array('title' => _LANGUAGE, 'type' => 'label'), 'name' => array('title' => _NAME, 'type' => 'label'), 'description' => array('title' => _DESCRIPTION, 'type' => 'label'));
    }
コード例 #29
0
    function __construct()
    {
        parent::__construct();
        global $objSettings;
        $this->params = array();
        ## for standard fields
        if (isset($_POST['email'])) {
            $this->params['email'] = prepare_input($_POST['email']);
        }
        if (isset($_POST['date_subscribed'])) {
            $this->params['date_subscribed'] = prepare_input($_POST['date_subscribed']);
        }
        ## for checkboxes
        //$this->params['field4'] = isset($_POST['field4']) ? prepare_input($_POST['field4']) : '0';
        ## for images (not necessary)
        //if(isset($_POST['icon'])){
        //	$this->params['icon'] = prepare_input($_POST['icon']);
        //}else if(isset($_FILES['icon']['name']) && $_FILES['icon']['name'] != ''){
        //	// nothing
        //}else if (self::GetParameter('action') == 'create'){
        //	$this->params['icon'] = '';
        //}
        ## for files:
        // define nothing
        //$this->params['language_id'] = MicroGrid::GetParameter('language_id');
        //$this->uPrefix 		= 'prefix_';
        $this->primaryKey = 'id';
        $this->tableName = TABLE_NEWS_SUBSCRIBED;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=mod_news_subscribed';
        $this->actions = array('add' => true, 'edit' => true, 'details' => false, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowTopButtons = false;
        $this->alertOnDelete = '';
        // leave empty to use default alerts
        $this->allowLanguages = false;
        //$this->languageId  	= ($this->params['language_id'] != '') ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = '';
        // WHERE .... / 'WHERE language_id = \''.$this->languageId.'\'';
        $this->ORDER_CLAUSE = 'ORDER BY ' . $this->tableName . '.date_subscribed DESC';
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isExportingAllowed = false;
        $this->arrExportingTypes = array('csv' => false);
        $this->isFilteringAllowed = true;
        // define filtering fields
        $this->arrFilteringFields = array(_EMAIL => array('table' => TABLE_NEWS_SUBSCRIBED, 'field' => 'email', 'type' => 'text', 'sign' => '%like%', 'width' => '140px', 'visible' => true));
        $datetime_format = get_datetime_format();
        ///$date_format_edit = get_date_format('edit');
        ///$currency_format = get_currency_format();
        if ($objSettings->GetParameter('date_format') == 'mm/dd/yyyy') {
            $this->sqlFieldDatetimeFormat = '%b %d, %Y %H:%i';
            $this->sqlFieldDateFormat = '%b %d, %Y';
        } else {
            $this->sqlFieldDatetimeFormat = '%d %b, %Y %H:%i';
            $this->sqlFieldDateFormat = '%d %b, %Y';
        }
        $this->SetLocale(Application::Get('lc_time_name'));
        // prepare languages array
        /// $total_languages = Languages::GetAllActive();
        /// $arr_languages      = array();
        /// foreach($total_languages[0] as $key => $val){
        /// 	$arr_languages[$val['abbreviation']] = $val['lang_name'];
        /// }
        ///////////////////////////////////////////////////////////////////////////////
        // #002. prepare translation fields array
        /// $this->arrTranslations = $this->PrepareTranslateFields(
        ///	array('field1', 'field2')
        /// );
        ///////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////
        // #003. prepare translations array for add/edit/detail modes
        /// $sql_translation_description = $this->PrepareTranslateSql(
        ///	TABLE_XXX_DESCRIPTION,
        ///	'gallery_album_id',
        ///	array('field1', 'field2')
        /// );
        ///////////////////////////////////////////////////////////////////////////////
        //----------------------------------------------------------------------
        // VIEW MODE
        // format: strip_tags
        // format: nl2br
        // format: 'format'=>'date', 'format_parameter'=>'M d, Y, g:i A'
        // format: 'format'=>'currency', 'format_parameter'=>'european|2' or 'format_parameter'=>'american|4'
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
									email,
									DATE_FORMAT(' . $this->tableName . '.date_subscribed, \'' . $this->sqlFieldDatetimeFormat . '\') as mod_date_subscribed
								FROM ' . $this->tableName;
        // define view mode fields
        $this->arrViewModeFields = array('email' => array('title' => _EMAIL, 'type' => 'label', 'align' => 'left', 'width' => '', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'tooltip' => '', 'maxlength' => '', 'format' => '', 'format_parameter' => ''), 'mod_date_subscribed' => array('title' => _DATE_SUBSCRIBED, 'type' => 'label', 'align' => 'center', 'width' => '200px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'tooltip' => '', 'maxlength' => '', 'format' => '', 'format_parameter' => ''));
        //----------------------------------------------------------------------
        // ADD MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address|password|date
        // 	 Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255... Ex.: 'validation_maxlength'=>'255'
        // - Validation Min Length: 4, 6... Ex.: 'validation_minlength'=>'4'
        // - Validation Max Value: 12, 255... Ex.: 'validation_maximum'=>'99.99'
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array('email' => array('title' => _EMAIL, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'maxlength' => '70', 'default' => '', 'validation_type' => 'email', 'unique' => true, 'visible' => true, 'autocomplete' => 'off'), 'date_subscribed' => array('title' => '', 'type' => 'hidden', 'required' => true, 'readonly' => false, 'default' => date('Y-m-d H:i:s')));
        //----------------------------------------------------------------------
        // EDIT MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address|password|date
        //   Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255... Ex.: 'validation_maxlength'=>'255'
        // - Validation Min Length: 4, 6... Ex.: 'validation_minlength'=>'4'
        // - Validation Max Value: 12, 255... Ex.: 'validation_maximum'=>'99.99'
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
									email,
									DATE_FORMAT(' . $this->tableName . '.date_subscribed, \'' . $this->sqlFieldDatetimeFormat . '\') as mod_date_subscribed
							FROM ' . $this->tableName . '
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('email' => array('title' => _EMAIL, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'maxlength' => '70', 'default' => '', 'validation_type' => 'email', 'unique' => true, 'visible' => true, 'autocomplete' => 'off'), 'mod_date_subscribed' => array('title' => _DATE_SUBSCRIBED, 'type' => 'label'));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('email' => array('title' => _EMAIL, 'type' => 'label'), 'mod_date_subscribed' => array('title' => _DATE_SUBSCRIBED, 'type' => 'label'));
        ///////////////////////////////////////////////////////////////////////////////
        // #004. add translation fields to all modes
        /// $this->AddTranslateToModes(
        /// $this->arrTranslations,
        /// array('name'        => array('title'=>_NAME, 'type'=>'textbox', 'width'=>'410px', 'required'=>true, 'maxlength'=>'', 'readonly'=>false),
        /// 	  'description' => array('title'=>_DESCRIPTION, 'type'=>'textarea', 'width'=>'410px', 'height'=>'90px', 'required'=>false, 'readonly'=>false)
        /// )
        /// );
        ///////////////////////////////////////////////////////////////////////////////
    }