/**
  * Show and process config category form
  *
  * @param void
  * @return null
  */
 function update_category()
 {
     // Access permissios
     if (!can_manage_configuration(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     // if
     $category = ConfigCategories::findById(get_id());
     if (!$category instanceof ConfigCategory) {
         flash_error(lang('config category dnx'));
         $this->redirectToReferer(get_url('administration'));
     }
     // if
     if ($category->isEmpty()) {
         flash_error(lang('config category is empty'));
         $this->redirectToReferer(get_url('administration'));
     }
     // if
     $options = $category->getOptions(false);
     $categories = ConfigCategories::getAll(false);
     tpl_assign('category', $category);
     tpl_assign('options', $options);
     tpl_assign('config_categories', $categories);
     $submited_values = array_var($_POST, 'options');
     if (is_array($submited_values)) {
         foreach ($options as $option) {
             //update global cache if available
             if (GlobalCache::isAvailable() && GlobalCache::key_exists('config_option_' . $option->getName())) {
                 GlobalCache::delete('config_option_' . $option->getName());
             }
             if ($option->getName() == "working_days") {
                 $new_value = "";
                 foreach (array_var($submited_values, $option->getName()) as $value) {
                     $new_value .= $value . ",";
                 }
                 $new_value = substr($new_value, 0, -1);
             } else {
                 $new_value = array_var($submited_values, $option->getName());
                 if (is_null($new_value) || $new_value == $option->getValue()) {
                     continue;
                 }
             }
             $option->setValue($new_value);
             $option->save();
             evt_add("config option changed", array('name' => $option->getName(), 'value' => $new_value));
         }
         // foreach
         flash_success(lang('success update config category', $category->getDisplayName()));
         ajx_current("back");
     }
     // if
 }
Exemplo n.º 2
0
if (can_manage_security(logged_user())) {
    $icons[] = array('ico' => 'ico-large-user', 'url' => get_url('administration', 'members'), 'name' => lang('users'), 'extra' => '<a class="internalLink coViewAction ico-add" href="' . owner_company()->getAddUserUrl() . '">' . lang('add user') . '</a>');
}
if (can_manage_security(logged_user())) {
    $icons[] = array('ico' => 'ico-large-group', 'url' => get_url('administration', 'groups'), 'name' => lang('groups'), 'extra' => '<a class="internalLink coViewAction ico-add" href="' . owner_company()->getAddGroupUrl() . '">' . lang('add group') . '</a>');
}
if (can_manage_security(logged_user()) && Plugins::instance()->isActivePlugin('mail')) {
    $icons[] = array('ico' => 'ico-large-email', 'url' => get_url('administration', 'mail_accounts'), 'name' => lang('mail accounts'), 'extra' => '<a class="internalLink coViewAction ico-add" href="' . get_url('mail', 'add_account') . '">' . lang('add mail account') . '</a>');
}
if (can_manage_templates(logged_user())) {
    $icons[] = array('ico' => 'ico-large-template', 'url' => get_url('template', 'index'), 'name' => lang('templates'), 'extra' => '<a class="internalLink coViewAction ico-add" href="' . get_url('template', 'add') . '">' . lang('add template') . '</a>');
}
if (can_manage_billing(logged_user())) {
    $icons[] = array('ico' => 'ico-large-billing', 'url' => get_url('billing', 'index'), 'name' => lang('billing'), 'extra' => '<a class="internalLink coViewAction ico-add" href="' . get_url('billing', 'add') . '">' . lang('add billing category') . '</a>');
}
if (can_manage_configuration(logged_user())) {
    $icons[] = array('ico' => 'ico-large-company', 'url' => get_url('administration', 'company'), 'name' => lang('organization data'), 'extra' => '');
    $icons[] = array('ico' => 'ico-large-custom-properties', 'url' => get_url('administration', 'custom_properties'), 'name' => lang('custom properties'), 'extra' => '');
    /*
    	$icons[] = array(
    		'ico' => 'ico-large-object-subtypes',
    		'url' => get_url('administration', 'object_subtypes'),
    		'name' => lang('object subtypes'),
    		'extra' => '',
    	);*/
    $icons[] = array('ico' => 'ico-large-configuration', 'url' => get_url('administration', 'configuration'), 'name' => lang('configuration'), 'extra' => '');
    $icons[] = array('ico' => 'ico-large-tools', 'url' => get_url('administration', 'tools'), 'name' => lang('administration tools'), 'extra' => '');
    /*FIXME if (!defined('ALLOW_UPGRADING') || ALLOW_UPGRADING) {
    		$icons[] = array(
    			'ico' => 'ico-large-upgrade',
    			'url' => get_url('administration', 'upgrade'),
 function tabs_submit()
 {
     ajx_current("empty");
     evt_add("tabs changed", null);
     if (!can_manage_configuration(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     foreach ($_POST['tabs'] as $id => $tab) {
         $ordering = (int) $tab['ordering'];
         $title = mysql_real_escape_string($tab['title']);
         $enabled = array_var($tab, 'enabled') == "on" ? 1 : 0;
         if ($tp = TabPanels::instance()->findById($id)) {
             $tp->setOrdering($ordering);
             $tp->setTitle($title);
             $tp->setEnabled($enabled);
             if ($enabled) {
                 $pg_id = logged_user()->getPermissionGroupId();
                 if (!TabPanelPermissions::isModuleEnabled($tp->getId(), $pg_id)) {
                     $tpp = new TabPanelPermission();
                     $tpp->setPermissionGroupId($pg_id);
                     $tpp->setTabPanelId($tp->getId());
                     $tpp->save();
                 }
             }
             $tp->save();
         }
     }
 }
Exemplo n.º 4
0
 /**
  * Check if specific user can edit this contact
  *
  * @access public
  * @param User $user
  * @return boolean
  */
 function canEdit(Contact $user)
 {
     if ($this->isUser()) {
         // a contact that has a user assigned to it can be modified by anybody that can manage security (this is: users and permissions) or the user himself.
         return can_manage_security($user) && ($this->getUserType() > $user->getUserType() || $user->isAdministrator()) || $this->getObjectId() == $user->getObjectId();
     }
     if ($this->isOwnerCompany()) {
         return can_manage_configuration($user);
     }
     return can_manage_contacts($user) || can_write($user, $this->getMembers(), $this->getObjectTypeId());
 }
Exemplo n.º 5
0
 function update_dimension_order()
 {
     ajx_current("empty");
     if (!can_manage_configuration(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $dim_list = json_decode(array_var($_REQUEST, 'dims'), true);
     try {
         if (is_array($dim_list)) {
             DB::beginWork();
             $pos = 1;
             foreach ($dim_list as $dim_id) {
                 $dim_id = str_replace("'", "", $dim_id);
                 DB::execute("UPDATE " . TABLE_PREFIX . "dimensions SET default_order={$pos} WHERE id='{$dim_id}'");
                 $pos++;
             }
             DB::commit();
         }
         ajx_extra_data(array('ok' => '1', 'msg' => lang('success reordering dimensions')));
     } catch (Exception $e) {
         DB::rollback();
         ajx_extra_data(array('error' => 'Error occurred while reordering dimensions: ' . $e->getMessage()));
     }
 }
 /**
  * Show and process config category form
  *
  * @param void
  * @return null
  */
 function update_category()
 {
     // Access permissios
     if (!can_manage_configuration(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     // if
     $category = ConfigCategories::findById(get_id());
     if (!$category instanceof ConfigCategory) {
         flash_error(lang('config category dnx'));
         $this->redirectToReferer(get_url('administration'));
     }
     // if
     if ($category->isEmpty()) {
         flash_error(lang('config category is empty'));
         $this->redirectToReferer(get_url('administration'));
     }
     // if
     $options = $category->getOptions(false);
     $categories = ConfigCategories::getAll(false);
     tpl_assign('category', $category);
     tpl_assign('options', $options);
     tpl_assign('config_categories', $categories);
     $submited_values = array_var($_POST, 'options');
     if (is_array($submited_values)) {
         foreach ($options as $option) {
             $new_value = array_var($submited_values, $option->getName());
             if (is_null($new_value) || $new_value == $option->getValue()) {
                 continue;
             }
             $option->setValue($new_value);
             $option->save();
         }
         // foreach
         flash_success(lang('success update config category', $category->getDisplayName()));
         ajx_current("back");
     }
     // if
 }
Exemplo n.º 7
0
<?php

$genid = gen_id();
$gs_step = config_option('getting_started_step');
$all_set = array_var($_REQUEST, 'more_settings_expanded');
?>

<div class="more-panel-container">
	<div class="title"><?php 
echo lang('learn about and manage your Feng Office');
?>
</div>

<?php 
if (can_manage_configuration(logged_user()) || can_manage_security(logged_user()) || can_manage_templates(logged_user()) || can_manage_billing(logged_user())) {
    ?>
	<div class="more-panel-section">
		<h1><?php 
    echo lang('quick system configuration and settings');
    ?>
</h1>
		<div class="section-content section1" style="<?php 
    echo $gs_step < 99 && !$all_set ? "max-width:100%;" : "";
    ?>
">
		<?php 
    tpl_assign('genid', $genid);
    $this->includeTemplate(get_template_path('section1', 'more'));
    ?>
		</div>
	</div>