/** * Used only for reports * @param unknown_type $external_conditions */ static function getAvailableObjectTypes($external_conditions = "") { $object_types = self::findAll(array( "conditions" => "`type` = 'content_object' AND `name` <> 'file revision' AND IF(plugin_id IS NULL OR plugin_id=0, true, (SELECT p.is_activated FROM ".TABLE_PREFIX."plugins p WHERE p.id=plugin_id) = true) AND `id` NOT IN (SELECT `object_type_id` FROM ".TabPanels::instance()->getTableName(true)." WHERE `enabled` = 0) $external_conditions" )); return $object_types; }
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(); } } }
<?php $panel = TabPanels::instance()->findById('documents-panel'); if ($panel instanceof TabPanel && $panel->getEnabled()) { $limit = 5 ; $result = ProjectFiles::instance()->listing(array( "order" => "name", "order_dir" => "asc", "start" => 0, "limit" => $limit )) ; $active_members = array(); $context = active_context(); foreach ($context as $selection) { if ($selection instanceof Member) $active_members[] = $selection; } if (count($active_members) > 0) { $mnames = array(); $allowed_contact_ids = array(); foreach ($active_members as $member) { $mnames[] = clean($member->getName()); } $widget_title = lang('documents'). ' '. lang('in').' '. implode(", ", $mnames); } $total = $result->total ; $documents = $result->objects; $genid = gen_id(); if ($total) { include_once 'template.php'; }
/** * Return manager instance * * @access protected * @param void * @return TabPanels */ function manager() { if(!($this->manager instanceof TabPanels)) $this->manager = TabPanels::instance(); return $this->manager; } // manager
/** * This function will return paginated result. Result is an array where first element is * array of returned object and second populated pagination object that can be used for * obtaining and rendering pagination data using various helpers. * * Items and pagination array vars are indexed with 0 for items and 1 for pagination * because you can't use associative indexing with list() construct * * @access public * @param array $arguments Query argumens (@see find()) Limit and offset are ignored! * @param integer $items_per_page Number of items per page * @param integer $current_page Current page number * @return array */ function paginate($arguments = null, $items_per_page = 10, $current_page = 1) { if (isset($this) && instance_of($this, 'TabPanels')) { return parent::paginate($arguments, $items_per_page, $current_page); } else { return TabPanels::instance()->paginate($arguments, $items_per_page, $current_page); } // if }
//animCollapse: false } <?php } ?> ]; if (! og.dimensionPanels.length ){ alert("In order to continue, you need to create dimensions (directly from database)."); } og.contextManager.construct(); og.objPickerTypeFilters = []; <?php $pg_id = logged_user()->getPermissionGroupId(); $obj_picker_type_filters = ObjectTypes::findAll(array("conditions" => "`type` = 'content_object'\n\t\tAND (plugin_id IS NULL OR plugin_id IN (SELECT distinct(id) FROM " . TABLE_PREFIX . "plugins WHERE is_installed = 1 AND is_activated = 1 ))\n\t\tAND `name` <> 'file revision' AND `id` NOT IN (\n\t\t\tSELECT `object_type_id` FROM " . TabPanels::instance()->getTableName(true) . " WHERE `enabled` = 0\n\t\t) OR `type` = 'comment' OR `name` = 'milestone'")); foreach ($obj_picker_type_filters as $type) { if (!$type instanceof ObjectType) { continue; } /* @var $type ObjectType */ $linkable = $type->getIsLinkableObjectType(); if ($linkable) { ?> og.objPickerTypeFilters.push({ id: '<?php echo $type->getName(); ?> ', name: '<?php echo lang($type->getName());
function enable_disable_system_modules() { ajx_current("empty"); if (!can_manage_configuration(logged_user())) { flash_error(lang('no access permissions')); ajx_current("empty"); return; } $module_list = json_decode(array_var($_REQUEST, 'modules'), true); try { DB::beginWork(); foreach ($module_list as $module_id => $enabled) { $tab_panel = TabPanels::instance()->findById($module_id); if ($tab_panel instanceof TabPanel) { $tab_panel->setEnabled($enabled > 0); $tab_panel->save(); if ($enabled > 0) { DB::execute("INSERT INTO " . TABLE_PREFIX . "tab_panel_permissions (permission_group_id, tab_panel_id) VALUES (" . logged_user()->getPermissionGroupId() . ",'" . $tab_panel->getId() . "') ON DUPLICATE KEY UPDATE tab_panel_id=tab_panel_id;"); } if ($tab_panel->getPluginId() > 0) { $plugin = Plugins::findById($tab_panel->getPluginId()); if ($plugin instanceof Plugin) { if ($enabled) { $plugin->activate(); } else { $plugin->deactivate(); } } } } } DB::commit(); } catch (Exception $e) { DB::rollback(); Logger::log("Error occurred when trying to enable/disable modules\n" . $e->getMessage() . "\n" . print_r($module_list, 1)); } }
minHeight: 10 //animate: false, //animCollapse: false } <?php endforeach; ?> ]; og.contextManager.construct(); og.objPickerTypeFilters = []; <?php $obj_picker_type_filters = ObjectTypes::findAll(array("conditions" => "`type` = 'content_object' AND (plugin_id IS NULL OR plugin_id IN (SELECT distinct(id) FROM ".TABLE_PREFIX."plugins WHERE is_installed = 1 AND is_activated = 1 )) 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;
/** * Return manager instance * * @access protected * @param void * @return TabPanels */ function manager() { if (!$this->manager instanceof TabPanels) { $this->manager = TabPanels::instance(); } return $this->manager; }
var tips_array = []; function addTip(div_id, title, bdy) { tips_array[cant_tips++] = new Ext.ToolTip({ target: div_id, html: bdy, title: title, hideDelay: 1500, closable: true }); } </script> <?php $calendar_panel = TabPanels::instance()->findById('calendar-panel'); if ($calendar_panel instanceof TabPanel && $calendar_panel->getEnabled()) { $genid = gen_id(); require_javascript('og/EventPopUp.js'); //$startday = date("d",mktime()) - (date("N", mktime()) %7); if (user_config_option("start_monday")) { $startday = date("j") - date("N") + 1; // beginning of the week, monday } else { $startday = date("j") - date("w"); // beginning of the week, sunday } //user_config_option('show_two_weeks_calendar',null,logged_user()->getId())? $my_weeks = 2 : $my_weeks = 1 ; $my_weeks = 2; $endday = $startday + 7 * $my_weeks; $today = DateTimeValueLib::now()->add('h', logged_user()->getTimezone());
function getAllowedObjectTypeContents() { return DimensionObjectTypeContents::findAll(array('conditions' => array("`dimension_id` = ?\n\t\t\tAND (`content_object_type_id` IN (SELECT `id` FROM " . ObjectTypes::instance()->getTableName(true) . " WHERE `type` = 'located')\n\t\t\tOR ( \n\t\t\t\t`content_object_type_id` NOT IN (SELECT `object_type_id` FROM " . TabPanels::instance()->getTableName(true) . " WHERE `enabled` = 0) \n\t \t\t\tAND `content_object_type_id` IN (\n\t \t\t\t\tSELECT `id` FROM " . ObjectTypes::instance()->getTableName(true) . " WHERE `type` = 'content_object' AND `name` <> 'file revision'\n\t \t\t\t\t\tAND IF(plugin_id is NULL OR plugin_id = 0, TRUE, plugin_id IN (SELECT id FROM " . TABLE_PREFIX . "plugins WHERE is_activated > 0 AND is_installed > 0))\n\t \t\t\t)\n \t\t\t))", $this->getId()), 'distinct' => true)); }
<?php $panel = TabPanels::instance()->findById('messages-panel'); if ($panel instanceof TabPanel && $panel->getEnabled()) { $limit = 5 ; $result = ProjectMessages::instance()->listing(array( "order" => "name", "order_dir" => "asc", "start" => 0, "limit" => $limit )) ; $active_members = array(); $context = active_context(); foreach ($context as $selection) { if ($selection instanceof Member) $active_members[] = $selection; } if (count($active_members) > 0) { $mnames = array(); $allowed_contact_ids = array(); foreach ($active_members as $member) { $mnames[] = clean($member->getName()); } $widget_title = lang('notes'). ' '. lang('in').' '. implode(", ", $mnames); } $total = $result->total ; $messages = $result->objects; $genid = gen_id(); if ($total) { include_once 'template.php';
/** * @param unknown_type $external_conditions */ static function getAvailableObjectTypesWithTimeslots($external_conditions = "") { $object_types = self::findAll(array("conditions" => "`type` IN ('content_object', 'located') AND \r\n\t\t\t`name` <> 'file revision' AND name <> 'template_task' AND name <> 'template_milestone' AND `name` <> 'template' AND \r\n\t\t\tIF(plugin_id IS NULL OR plugin_id=0, true, (SELECT p.is_activated FROM " . TABLE_PREFIX . "plugins p WHERE p.id=plugin_id) = true) AND\r\n\t\t\t`id` NOT IN (SELECT `object_type_id` FROM " . TabPanels::instance()->getTableName(true) . " WHERE `enabled` = 0) {$external_conditions}")); return $object_types; }
/** * Used only for reports * @param unknown_type $external_conditions */ static function getAvailableObjectTypes($external_conditions = "") { $object_types = self::findAll(array("conditions" => "`type` = 'content_object' AND \n\t\t\t`name` <> 'file revision' AND \n\t\t\t`id` NOT IN (SELECT `object_type_id` FROM " . TabPanels::instance()->getTableName(true) . " WHERE `enabled` = 0) {$external_conditions}")); return $object_types; }