コード例 #1
0
 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();
         }
     }
 }
コード例 #2
0
ファイル: website.php プロジェクト: Jtgadbois/Pedadida
		AND `name` <> 'file revision' AND `id` NOT IN (
			SELECT `object_type_id` FROM ".TabPanels::instance()->getTableName(true)." WHERE `enabled` = 0
		)  OR `type` = 'comment' OR `name` = 'milestone'"));
	
	$pg_ids = logged_user()->getPermissionGroupIds();
	if (!is_array($pg_ids) || count($pg_ids) == 0) $pg_ids = array(0);
	
	foreach ($obj_picker_type_filters as $type) {
		if (! $type instanceof  ObjectType ) continue ;
		/* @var $type ObjectType */
		$linkable = $type->getIsLinkableObjectType();
		if ($linkable) {
			$tab_ids = DB::executeAll("SELECT id FROM ".TABLE_PREFIX."tab_panels WHERE object_type_id = ".$type->getId());
			if (count($tab_ids) > 0) {
				$tab_id = $tab_ids[0]['id'];
				if (!TabPanelPermissions::isModuleEnabled($tab_id, implode(',', $pg_ids))) {
					continue;
				}
			}
?>
			og.objPickerTypeFilters.push({
				id: '<?php echo $type->getName() ?>',
				name: '<?php echo lang($type->getName()) ?>',
				type: '<?php echo $type->getName() ?>',
				filter: 'type',
				iconCls: 'ico-<?php echo $type->getIcon() ?>'
			});
<?php
		}
	}
?>