Esempio n. 1
0
 protected function actionSubmit($params)
 {
     if (\GO::modules()->addressbook && \GO::modules()->customfields) {
         // Remove all existing records from the table
         $tabs = \GO\Users\Model\CfSettingTab::model()->find();
         foreach ($tabs as $t) {
             $t->delete();
         }
         $contactClassName = \GO\Addressbook\Model\Contact::model()->className();
         $customfieldsCategories = \GO\Customfields\Model\Category::model()->findByModel($contactClassName);
         // Add the posted records back to the table (go_cf_setting_tabs)
         foreach ($customfieldsCategories as $cfc) {
             if (isset($params['tab_cf_cat_' . $cfc->id])) {
                 $cft = new \GO\Users\Model\CfSettingTab();
                 $cft->cf_category_id = $cfc->id;
                 $cft->save();
             }
         }
     }
     $settings = \GO\Users\Model\Settings::load();
     return array('success' => $settings->saveFromArray($params), 'data' => $settings->getArray());
 }
Esempio n. 2
0
$GO_SCRIPTS_JS .= 'GO.addressbook.lang.defaultSalutationExpression="' . \GO\Base\Util\String::escape_javascript(\GO::t('defaultSalutation', 'addressbook')) . '";';
$export_acl_id = \GO::config()->get_setting('go_addressbook_export', 0);
if (!$export_acl_id) {
    $acl = new \GO\Base\Model\Acl();
    $acl->description = 'addressbook_export';
    $acl->save();
    $export_acl_id = $acl->id;
    \GO::config()->save_setting('go_addressbook_export', $acl->id, 0);
}
$GO_SCRIPTS_JS .= 'GO.addressbook.export_acl_id="' . $export_acl_id . '";';
$acl_level = \GO\Base\Model\Acl::getUserPermissionLevel($export_acl_id, \GO::user()->id);
$GO_SCRIPTS_JS .= 'GO.addressbook.exportPermission="' . ($acl_level ? 1 : 0) . '";';
if (\GO::modules()->customfields) {
    $GO_SCRIPTS_JS .= '

	GO.customfields.settingsPanels={
		name: "' . \GO\Addressbook\Model\Contact::model()->localizedName . '",
		panels: []
	};' . "\n";
    $stmt = \GO\Users\Model\CfSettingTab::model()->getSettingTabs();
    while ($category = $stmt->fetch()) {
        $fields = array();
        $fstmt = $category->fields();
        while ($field = $fstmt->fetch()) {
            $fields[] = $field->toJsonArray();
        }
        // Makes global, client-side, editable form panels for every customfield category
        $GO_SCRIPTS_JS .= "\n\n" . 'GO.customfields.settingsPanels.panels.push({xtype : "customformpanel", itemId:"cf-panel-' . $category->id . '", category_id: ' . $category->id . ', title : "' . htmlspecialchars($category->name, ENT_QUOTES, 'UTF-8') . '", customfields : ' . json_encode($fields) . '});' . "\n";
    }
}
Esempio n. 3
0
$settings['config']['max_file_size'] = \GO::config()->max_file_size;
$settings['config']['help_link'] = \GO::config()->help_link;
$settings['config']['support_link'] = \GO::config()->support_link;
$settings['config']['nav_page_size'] = intval(\GO::config()->nav_page_size);
$settings['config']['session_inactivity_timeout'] = intval(\GO::config()->session_inactivity_timeout);
$settings['config']['tickets_no_email_required'] = GO::config()->tickets_no_email_required;
$settings['config']['default_country'] = \GO::config()->default_country;
$settings['config']['checker_interval'] = (int) \GO::config()->checker_interval;
$settings['show_contact_cf_tabs'] = array();
$settings['config']['encode_callto_link'] = \GO::config()->encode_callto_link;
if (GO::modules()->addressbook) {
    // Add the addresslist tab to the global settings panel
    $settings['show_addresslist_tab'] = \GO::config()->get_setting('globalsettings_show_tab_addresslist');
    if (\GO::modules()->customfields) {
        $settings['show_contact_cf_tabs'] = array();
        $tabsEnabledStmt = \GO\Users\Model\CfSettingTab::model()->find();
        $tabsEnabled = $tabsEnabledStmt->fetchAll(PDO::FETCH_COLUMN);
        // Add the contact customfield tabs to the global settings panel
        $contactClassName = \GO\Addressbook\Model\Contact::model()->className();
        $customfieldsCategories = \GO\Customfields\Model\Category::model()->findByModel($contactClassName);
        foreach ($customfieldsCategories as $cfc) {
            if (in_array($cfc->id, $tabsEnabled)) {
                $settings['show_contact_cf_tabs'][$cfc->id] = true;
            }
        }
    }
}
$settings['upload_quickselect'] = GO::config()->upload_quickselect;
$root_uri = \GO::config()->debug ? \GO::config()->host : \GO::config()->root_path;
$view_root_uri = $root_uri . 'views/Extjs3/';
$view_root_path = \GO::config()->root_path . 'views/Extjs3/';