/** * Print admin area errors * * @param string $msg The message of error * @param bool $navigation [optional] Show the side mneu or not * @param string $title [optional] The title of the error * @param bool $exit [optional] halt after showing the error * @param bool|string $redirect [optional] if link given it will redirected to it after $rs seconds * @param int $rs [optional] if $redirected is given and not false, this will be the time in seconds * @param string $style [optional] this is just here to use it inside kleeja_admin_info to use admin_info */ function kleeja_admin_err($msg, $navigation = true, $title = '', $exit = true, $redirect = false, $rs = 5, $style = 'error.php') { global $text, $tpl, $SHOW_LIST, $adm_extensions, $adm_extensions_menu; global $STYLE_PATH_ADMIN, $lang, $plugin, $SQL, $MINI_MENU; ($hook = $plugin->run_hook('kleeja_admin_err_func')) ? eval($hook) : null; //run hook #Exception for ajax if (isset($_GET['_ajax_'])) { $text = $msg . ($redirect ? "\n" . '<script type="text/javascript"> setTimeout("location.href=\'' . str_replace('&', '&', $redirect) . '\';", ' . $rs * 1000 . ');</script>' : ''); echo_ajax(1, $tpl->display($style)); $SQL->close(); exit; } #assign {text} in err template $text = $msg . ($redirect != false ? redirect($redirect, false, false, $rs, true) : ''); $SHOW_LIST = $navigation; #header include get_template_path('header.php'); #show tpl include get_template_path($style); #footer include get_template_path('footer.php'); #show tpl //echo $tpl->display($style); #footer //echo $tpl->display("admin_footer"); #if exit, clean it if ($exit) { garbage_collection(); exit; } }
/** * Render pagination block * * Parameters: * * - page - current_page * - total_pages - total pages * - route - route for URL assembly * * @param array $params * @param Smarty $smarty * @return string */ function smarty_function_mobile_access_paginator($params, &$smarty) { $url_params = ''; if (is_foreachable($params)) { foreach ($params as $k => $v) { if (strpos($k, 'url_param_') !== false && $v) { $url_params .= '&' . substr($k, 10) . '=' . $v; } // if } // foreach } // if $paginator = array_var($params, 'paginator', new Pager()); $paginator_url = array_var($params, 'url', ROOT_URL); $paginator_anchor = array_var($params, 'anchor', ''); $smarty->assign(array("_mobile_access_paginator_url" => $paginator_url, "_mobile_access_paginator" => $paginator, '_mobile_access_paginator_anchor' => $paginator_anchor, "_mobile_access_paginator_url_params" => $url_params)); $paginator_url = strpos($paginator_url, '?') === false ? $paginator_url . '?' : $paginator_url . '&'; if (!$paginator->isFirst()) { $smarty->assign('_mobile_access_paginator_prev_url', $paginator_url . 'page=' . ($paginator->getCurrentPage() - 1) . $url_params . $paginator_anchor); } // if if (!$paginator->isLast()) { $smarty->assign('_mobile_access_paginator_next_url', $paginator_url . 'page=' . ($paginator->getCurrentPage() + 1) . $url_params . $paginator_anchor); } // if return $smarty->fetch(get_template_path('_paginator', null, MOBILE_ACCESS_MODULE)); }
/** * Show and process config category form * * @param void * @return null */ function update_category() { $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); $submitted_values = array_var($_POST, 'options'); if (is_array($submitted_values)) { foreach ($options as $option) { $new_value = array_var($submitted_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())); $this->redirectTo('administration', 'configuration'); } // if $this->setSidebar(get_template_path('update_category_sidebar', 'config')); }
/** * Advanced pagination. Differenced between simple and advanced paginations is that * advanced pagination uses template so its output can be changed in a great number of ways. * * All variables are just passed to the template, nothing is done inside the function! * * @access public * @param DataPagination $pagination Pagination object * @param string $url_base Base URL in witch we will insert current page number * @param string $template Template that will be used. It can be absolute path to existing file * or template name that used with get_template_path will return real template path * @param string $page_placeholder Short string inside of $url_base that will be replaced with * current page numer * @return null */ function advanced_pagination(DataPagination $pagination, $url_base, $template = 'advanced_pagination', $page_placeholder = '#PAGE#') { tpl_assign(array('advanced_pagination_object' => $pagination, 'advanced_pagination_url_base' => $url_base, 'advanced_pagination_page_placeholder' => urlencode($page_placeholder))); // tpl_assign $template_path = is_file($template) ? $template : get_template_path($template); return tpl_fetch($template_path); }
/** * Render comments * * Parameters: * * - comments - comments that needs to be rendered * - page - current_page * - total_pages - total pages * - counter - counter for comment # * - url - base URL for link assembly * - parent - parent object * * @param array $params * @param Smarty $smarty * @return string */ function smarty_function_mobile_access_object_comments($params, &$smarty) { $url_params = ''; if (is_foreachable($params)) { foreach ($params as $k => $v) { if (strpos($k, 'url_param_') !== false && $v) { $url_params .= '&' . substr($k, 10) . '=' . $v; } // if } // foreach } // if $object = array_var($params, 'object'); if (!instance_of($object, 'ProjectObject')) { return new InvalidParamError('object', $object, '$object is expected to be an instance of ProjectObject class', true); } // if $user = array_var($params, 'user'); if (!instance_of($user, 'User')) { return new InvalidParamError('object', $user, '$user is expected to be an instance of User class', true); } // if $page = array_var($params, 'page', 1); $page = (int) array_var($_GET, 'page'); if ($page < 1) { $page = 1; } // if $counter = array_var($params, 'counter', 1); $counter = ($page - 1) * $object->comments_per_page + $counter; list($comments, $pagination) = $object->paginateComments($page, $object->comments_per_page, $user->getVisibility()); $smarty->assign(array("_mobile_access_comments_comments" => $comments, "_mobile_access_comments_paginator" => $pagination, "_mobile_access_comments_url" => mobile_access_module_get_view_url($object), "_mobile_access_comments_url_params" => $url_params, "_mobile_access_comments_counter" => $counter, "_mobile_access_comments_show_counter" => array_var($params, 'show_counter', true))); return $smarty->fetch(get_template_path('_object_comments', null, MOBILE_ACCESS_MODULE)); }
/** * Render object subscribers * * @param array $params * @param Smarty $smarty * @return string */ function smarty_function_object_subscriptions($params, &$smarty) { $object = array_var($params, 'object'); if (!instance_of($object, 'ProjectObject')) { return new InvalidParamError('object', $object, '$object is expected to be an instance of ProjectObject class', true); } // if js_assign('max_subscribers_count', MAX_SUBSCRIBERS_COUNT); require_once SYSTEM_MODULE_PATH . '/helpers/function.user_link.php'; $subscribers = $object->getSubscribers(); if (count($subscribers) > MAX_SUBSCRIBERS_COUNT) { $smarty->assign(array('_object_subscriptions_list_subscribers' => false, '_object_subscriptions_object' => $object, '_object_subscriptions_subscribers_count' => count($subscribers), '_object_subscription_brief' => array_var($params, 'brief', false), '_object_subscriptions_popup_url' => assemble_url('object_subscribers_widget', array('object_id' => $object->getId())))); } else { $links = null; if (is_foreachable($subscribers)) { $links = array(); foreach ($subscribers as $subscriber) { $links[] = smarty_function_user_link(array('user' => $subscriber), $smarty); } // foreach } // if $smarty->assign(array('_object_subscriptions_list_subscribers' => true, '_object_subscriptions' => $subscribers, '_object_subscriptions_object' => $object, '_object_subscription_links' => $links, '_object_subscription_brief' => array_var($params, 'brief', false), '_object_subscriptions_popup_url' => assemble_url('object_subscribers_widget', array('object_id' => $object->getId())))); } // if return $smarty->fetch(get_template_path('_object_subscriptions', 'subscriptions', RESOURCES_MODULE)); }
/** * Render object tasks section * * Parameters: * * - object - Selected project object * * @param array $params * @param Smarty $smarty * @return string */ function smarty_function_object_tasks($params, &$smarty) { $object = array_var($params, 'object'); if (!instance_of($object, 'ProjectObject')) { return new InvalidParamError('object', $object, '$object is expected to be an instance of ProjectObject class', true); } // if $open_tasks = $object->getOpenTasks(); if (is_foreachable($open_tasks)) { foreach ($open_tasks as $open_task) { ProjectObjectViews::log($open_task, $smarty->get_template_vars('logged_user')); } // foreach } // if $completed_tasks = $object->getCompletedTasks(COMPLETED_TASKS_PER_OBJECT); if (is_foreachable($completed_tasks)) { foreach ($completed_tasks as $completed_task) { ProjectObjectViews::log($completed_task, $smarty->get_template_vars('logged_user')); } // foreach } // if $smarty->assign(array('_object_tasks_object' => $object, '_object_tasks_open' => $open_tasks, '_object_tasks_can_reorder' => (int) $object->canEdit($smarty->get_template_vars('logged_user')), '_object_tasks_completed' => $completed_tasks, '_object_tasks_completed_remaining' => $object->countCompletedTasks() - COMPLETED_TASKS_PER_OBJECT, '_object_tasks_skip_wrapper' => array_var($params, 'skip_wrapper', false), '_object_tasks_skip_head' => array_var($params, 'skip_head', false), '_object_tasks_force_show' => array_var($params, 'force_show', true))); return $smarty->fetch(get_template_path('_object_tasks', 'tasks', RESOURCES_MODULE)); }
/** * Execute the script * * @param void * @return boolean */ function execute() { // --------------------------------------------------- // Check MySQL version // --------------------------------------------------- $mysql_version = mysql_get_server_info($this->database_connection); if ($mysql_version && version_compare($mysql_version, '4.1', '>=')) { $constants['DB_CHARSET'] = 'utf8'; @mysql_query("SET NAMES 'utf8'", $this->database_connection); tpl_assign('default_collation', $default_collation = 'collate utf8_unicode_ci'); tpl_assign('default_charset', $default_charset = 'DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci'); } else { tpl_assign('default_collation', $default_collation = ''); tpl_assign('default_charset', $default_charset = ''); } // if tpl_assign('table_prefix', TABLE_PREFIX); // --------------------------------------------------- // Execute migration // --------------------------------------------------- $total_queries = 0; $executed_queries = 0; $upgrade_script = tpl_fetch(get_template_path('db_migration/1_0_milanga')); if ($this->executeMultipleQueries($upgrade_script, $total_queries, $executed_queries, $this->database_connection)) { $this->printMessage("Database schema transformations executed (total queries: {$total_queries})"); } else { $this->printMessage('Failed to execute DB schema transformations. MySQL said: ' . mysql_error(), true); return false; } // if $this->printMessage('Feng Office has been upgraded. You are now running Feng Office ' . $this->getVersionTo() . ' Enjoy!'); }
/** * List object comments * * Parameters: * * - object - Parent object. It needs to be an instance of ProjectObject class * - comments - List of comments. It is optional. If it is missing comments * will be loaded by calling getCommetns() method of parent object * * @param array $params * @param Smarty $smarty * @return string */ function smarty_function_object_comments_all($params, &$smarty) { $object = array_var($params, 'object'); if (!instance_of($object, 'ProjectObject')) { return new InvalidParamError('object', $object, '$object is expected to be an instance of ProjectObject class', true); } // if $logged_user = $smarty->get_template_vars('logged_user'); if (!instance_of($logged_user, 'User')) { return ''; } // if $visiblity = $logged_user->getVisibility(); // if ($object->canView($logged_user) && $object->getVisibility() == VISIBILITY_PRIVATE) { if ($object->canView($logged_user)) { $visiblity = VISIBILITY_PRIVATE; } $comments = $object->getComments($visiblity); if (is_foreachable($comments)) { foreach ($comments as $comment) { ProjectObjectViews::log($comment, $logged_user); //BOF:task_1260 $comment->set_action_request_n_fyi_flag($logged_user); //EOF:task_1260 } // foreach } // if $count_from = 0; $smarty->assign(array('_object_comments_object' => $object, '_object_comments_count_from' => $count_from, '_object_comments_comments' => $comments, '_total_comments' => sizeof($comments))); return $smarty->fetch(get_template_path('_object_comments_all', 'comments', RESOURCES_MODULE)); }
function tickets_dashboard_content($context) { $tickets = ProjectTickets::getOpenTicketsByUser(logged_user()); $context->assign('ticketsheader', lang('open tickets')); $context->assign('tickets', $tickets); $context->includeTemplate(get_template_path('dashboard', 'tickets')); }
function minify() { $this->setTemplate(get_template_path("empty")); if (!logged_user()->isAdministrator()) { die("You must be an administrator to run this tool."); } // include libraries include_once LIBRARY_PATH . '/jsmin/JSMin.class.php'; include_once LIBRARY_PATH . '/cssmin/CSSMin.class.php'; // process arguments $minify = isset($_GET['minify']); // process javascripts echo "Concatenating javascripts ... \n"; $files = (include "application/layouts/javascripts.php"); $jsmin = ""; foreach ($files as $file) { $jsmin .= file_get_contents("public/assets/javascript/{$file}") . "\n"; } echo "Done!<br>\n"; if ($minify) { echo "Minifying javascript ... \n"; $jsmin = JSMin::minify($jsmin); echo "Done!<br>\n"; } echo "Writing to file 'ogmin.js' ... "; file_put_contents("public/assets/javascript/ogmin.js", $jsmin); echo "Done!<br>"; echo "<br>"; // process CSS function changeUrls($css, $base) { return preg_replace("/url\\s*\\(\\s*['\"]?([^\\)'\"]*)['\"]?\\s*\\)/i", "url(" . $base . "/\$1)", $css); } function parseCSS($filename, $filebase, $imgbase) { $css = file_get_contents($filebase . $filename); $imports = explode("@import", $css); $cssmin = changeUrls($imports[0], $imgbase); for ($i = 1; $i < count($imports); $i++) { $split = explode(";", $imports[$i], 2); $import = trim($split[0], " \t\n\r\v'\""); $cssmin .= parseCSS($import, $filebase, $imgbase . "/" . dirname($import)); $cssmin .= changeUrls($split[1], $imgbase); } return $cssmin; } echo "Concatenating CSS ... "; $cssmin = parseCSS("website.css", "public/assets/themes/default/stylesheets/", "."); echo "Done!<br>"; if ($minify) { echo "Minifying CSS ... "; $cssmin = CSSMin::minify($cssmin); echo "Done!<br>"; } echo "Writing to file 'ogmin.css' ... "; file_put_contents("public/assets/themes/default/stylesheets/ogmin.css", $cssmin); echo "Done!<br>"; die; }
function displayPWchanger() { global $smarty; $smarty->assign("logo", image(get_template_path("images/logo.png"))); $smarty->assign("date", date("l, dS F Y H:i:s O")); $smarty->display(get_template_path('password.tpl')); exit; }
/** * render a template file, using the vars supplied * * @param string $template template file can be withouth the extension and should be relative to the templates dir * @param array $vars * @return string */ function render($template, array $vars = array()) { $file = get_template_path($template); extract($vars); ob_start(); include $file; return ob_get_clean(); }
/** * Render project breadcrumbs block * * Parameters: * * - breadcrumbs - array of breadcrumbs * * @param array $params * @param Smarty $smarty * @return string */ function smarty_function_mobile_access_project_breadcrumbs($params, &$smarty) { if (!is_foreachable($breadcrumbs = array_var($params, 'breadcrumbs', null))) { return null; } $smarty->assign(array("mobile_access_project_breadcrumbs_breadcrumbs" => $breadcrumbs)); return $smarty->fetch(get_template_path('_project_breadcrumbs', null, MOBILE_ACCESS_MODULE)); }
/** * Show project card * * @param array $params * @param Smarty $smarty * @return string */ function smarty_function_project_card($params, &$smarty) { $project = array_var($params, 'project'); if (!instance_of($project, 'Project')) { return new InvalidParamError('project', $project, '$project is expected to be an instance of Project class', true); } // if $smarty->assign(array('_card_project' => $project, '_card_project_company' => $project->getCompany())); return $smarty->fetch(get_template_path('_card', 'project', SYSTEM_MODULE)); }
/** * Render activities block * * Parameters: * * - activities - array of groupped activities * - project_column - show project column * * @param array $params * @param Smarty $smarty * @return string */ function smarty_function_activities($params, &$smarty) { $activities = array_var($params, 'activities'); if (!is_foreachable($activities)) { return ''; } // if $smarty->assign(array('_activities' => $activities, '_activities_project_column' => (bool) array_var($params, 'project_column', true))); return $smarty->fetch(get_template_path('_activities', null, SYSTEM_MODULE)); }
/** * Render post tasks form * * Parameteres: * * - object - Attach task to this object * * @param array $params * @param Smarty $smarty * @return string */ function smarty_function_post_task_form($params, &$smarty) { $object = array_var($params, 'object'); if (!instance_of($object, 'ProjectObject')) { return new InvalidParamError('object', $object, '$object is expected to be an instance of ProjectObject class', true); } // if $smarty->assign(array('_post_task_form_object' => $object)); return $smarty->fetch(get_template_path('_post_task_form', 'tasks', RESOURCES_MODULE)); }
/** * Render project progress bar * * @param array $params * @param Smarty $smarty * @return string */ function smarty_function_project_progress($params, &$smarty) { $project = array_var($params, 'project'); if (!instance_of($project, 'Project')) { return new InvalidParamError('project', $project, '$project is expected to be an instance of Project class', true); } // if $smarty->assign(array('_project_progress' => $project, '_project_progress_info' => (bool) array_var($params, 'info', true))); return $smarty->fetch(get_template_path('_projects_progress', 'project', SYSTEM_MODULE)); }
/** * Render add comment form * * Parameters: * * - parent - comment parent * - comment_data - POST comment data * * @param array $params * @param Smarty $smarty * @return string */ function smarty_function_mobile_access_add_comment_form($params, &$smarty) { $parent = array_var($params, 'parent'); if (!instance_of($parent, 'ProjectObject')) { return new InvalidParamError('object', $parent, '$object is expected to be an instance of ProjectObject class', true); } // if $smarty->assign(array('_mobile_access_add_comment_form_add_comment_url' => mobile_access_module_get_add_comment_url($parent), '_mobile_access_add_comment_form_comment_data' => array_var($params, 'comment_data', array()))); return $smarty->fetch(get_template_path('_add_comment_form', null, MOBILE_ACCESS_MODULE)); }
/** * Render block of the recent activities for selected user * * - recent_activities - array of groupped recent activities * * @param array $params * @param Smarty $smarty * @return string */ function smarty_function_recent_activities($params, &$smarty) { $recents = array_var($params, 'recent_activities'); if (!is_foreachable($recents)) { return ''; } // if $smarty->assign(array('_recents' => $recents)); return $smarty->fetch(get_template_path('_recent_activities_for_selected_user', null, SYSTEM_MODULE)); }
/** * Render company card * * Parameters: * * - company - company instance * * @param array $params * @param Smarty $smarty * @return string */ function smarty_function_company_card($params, &$smarty) { $company = array_var($params, 'company'); if (!instance_of($company, 'Company')) { return new InvalidParamError('company', $company, '$company is expected to be an valid Company instance', true); } // if $smarty->assign(array('_card_company' => $company, '_card_options' => $company->getOptions(get_logged_user()))); return $smarty->fetch(get_template_path('_card', 'companies', SYSTEM_MODULE)); }
/** * Show user card * * @param array $params * @param Smarty $smarty * @return string */ function smarty_function_user_card($params, &$smarty) { $user = array_var($params, 'user'); if (!instance_of($user, 'User')) { return new InvalidParamError('user', $user, '$user is expected to be an instance of User class', true); } // if $smarty->assign(array('_card_user' => $user, '_card_options' => $user->getOptions(get_logged_user()))); return $smarty->fetch(get_template_path('_card', 'users', SYSTEM_MODULE)); }
/** * List all milestones in specific (this) project * * @access public * @param void * @return null */ function index() { $this->addHelper('textile'); $project = active_project(); tpl_assign('late_milestones', $project->getLateMilestones()); tpl_assign('today_milestones', $project->getTodayMilestones()); tpl_assign('upcoming_milestones', $project->getUpcomingMilestones()); tpl_assign('completed_milestones', $project->getCompletedMilestones()); $this->setSidebar(get_template_path('index_sidebar', 'milestone')); }
/** * Render select assignees box * * Parameters: * * - object - Parent object * - project - Show only users that have access to this project * - company - SHow only users that are members of tis company * - exclude - ID-s of users that need to be excluded * - value - Array of selected users as first element and ID of task * owner as second * - name - Base name * * @param array $params * @param Smarty $smarty * @return string */ function smarty_function_select_assignees($params, &$smarty) { static $counter = 0; $name = array_var($params, 'name'); if ($name == '') { return new InvalidParamError('name', $name, '$name is expected to be a valid control name', true); } // if $id = array_var($params, 'id'); if (empty($id)) { $counter++; $id = 'select_assignees_' . $counter; } // if $exclude_ids = array_var($params, 'exclude', array()); if (is_foreachable($exclude_ids) && is_foreachable($selected_user_ids)) { foreach ($selected_user_ids as $k => $v) { if (in_array($v, $exclude_ids)) { unset($selected_user_ids[$k]); } // if } // foreach } // if $value = array_var($params, 'value', array(), true); if (count($value) == 2) { list($selected_user_ids, $owner_id) = $value; } else { $selected_user_ids = null; $owner_id = null; } // if if (is_foreachable($selected_user_ids)) { $selected_users = Users::findByIds($selected_user_ids); } else { $selected_users = null; } // if $company = array_var($params, 'company'); $project = array_var($params, 'project'); $company_id = 0; if (instance_of($company, 'Company')) { $company_id = $company->getId(); } // if $project_id = 0; if (instance_of($project, 'Project')) { $project_id = $project->getId(); } // if require_once ANGIE_PATH . '/classes/json/init.php'; $smarty->assign(array('_select_assignees_id' => $id, '_select_assignees_name' => $name, '_select_assignees_users' => $selected_users, '_select_assignees_owner_id' => $owner_id, '_select_assignees_company_id' => do_json_encode($company_id), '_select_assignees_project_id' => do_json_encode($project_id), '_select_assignees_exclude_ids' => do_json_encode($exclude_ids))); return $smarty->fetch(get_template_path('_select_assignees', null, RESOURCES_MODULE)); }
function delete_state() { $this->setTemplate(get_template_path('back')); ajx_current("empty"); try { $query = "DELETE FROM `" . TABLE_PREFIX . "guistate` WHERE `contact_id` = " . DB::escape(logged_user()->getId()); DB::executeAll($query); flash_success(lang("success reset gui state")); } catch (Exception $e) { flash_error($e->getMessage()); } }
/** * Submit specific project form * * @param void * @return null */ function submit() { $this->addHelper('textile'); $project_form = ProjectForms::findById(get_id()); if (!$project_form instanceof ProjectForm) { flash_error(lang('project form dnx')); $this->redirectToUrl(active_project()->getOverviewUrl()); } // if $in_object = $project_form->getInObject(); if (!$in_object instanceof ProjectMessage && !$in_object instanceof ProjectTaskList) { flash_error(lang('related project form object dnx')); $this->redirectToUrl(active_project()->getOverviewUrl()); } // if if (!$project_form->canSubmit(logged_user())) { flash_error(lang('no access permissions')); $this->redirectToUrl(active_project()->getOverviewUrl()); } // if $project_form_data = array_var($_POST, 'project_form_data'); tpl_assign('visible_forms', active_project()->getVisibleForms(true)); tpl_assign('project_form', $project_form); tpl_assign('project_form_data', $project_form_data); $this->setSidebar(get_template_path('submit_sidebar', 'form')); if (is_array($project_form_data)) { $content = trim(array_var($project_form_data, 'content')); if ($content == '') { tpl_assign('error', new Error(lang('form content required'))); $this->render(); } // if try { DB::beginWork(); if ($in_object instanceof ProjectMessage) { $comment = $in_object->addComment($content, false); ApplicationLogs::createLog($comment, active_project(), ApplicationLogs::ACTION_ADD, $comment->isPrivate()); } elseif ($in_object instanceof ProjectTaskList) { $task = $in_object->addTask($content); ApplicationLogs::createLog($task, active_project(), ApplicationLogs::ACTION_ADD, $in_object->isPrivate()); } // if DB::commit(); flash_success($project_form->getSuccessMessage()); $this->redirectToUrl($project_form->getSubmitUrl()); } catch (Exception $e) { tpl_assign('error', $e); DB::rollback(); } // try } // if }
/** * Show a list of objects * * Parameters: * * - objects - Array of objects that need to be listed * - id - Table ID, if not present ID will be generated * - show_priority - Show priority * - url_prefix - prefix for generated links * - show_created_on - show created on field * - show_start_on - show start on field * - show_due_on - show due on field * - skip_table_tag - to skip <table> tag when outputing template * * @param array $params * @param Smarty $smarty * @return string */ function smarty_function_project_exporter_list_objects($params, &$smarty) { static $counter = 1; $id = array_var($params, 'id'); if (empty($id)) { $id = 'objects_list_' . $counter; $counter++; } // if $smarty->assign(array('_list_objects_objects' => array_var($params, 'objects'), '_list_objects_id' => $id, '_list_objects_show_priority' => (bool) array_var($params, 'show_priority', false), '_list_objects_url_prefix' => array_var($params, 'url_prefix'), '_list_objects_show_created_on' => array_var($params, 'show_created_on', true), '_list_objects_show_start_on' => array_var($params, 'show_start_on', false), '_list_objects_show_due_on' => array_var($params, 'show_due_on', false), '_list_objects_skip_table_tag' => array_var($params, 'skip_table_tag', false))); return $smarty->fetch(get_template_path('_project_exporter_list_objects', null, PROJECT_EXPORTER_MODULE)); }
/** * Show a list of categories * * Parameters: * * - categories - Array of categories that need to be listed * - current_category - Currently displayed category * - title - title for first element * - url_prefix - prefix for generated links * * @param array $params * @param Smarty $smarty * @return string */ function smarty_function_project_exporter_list_categories($params, &$smarty) { static $counter = 1; $id = array_var($params, 'id'); if (empty($id)) { $id = 'objects_list_' . $counter; $counter++; } // if $smarty->assign(array('_list_objects_categories' => array_var($params, 'categories'), '_list_objects_current_category' => array_var($params, 'current_category'))); return $smarty->fetch(get_template_path('_project_exporter_list_categories', null, PROJECT_EXPORTER_MODULE)); }
/** * Render categories * * Parameters: * * - categories - list of categories * - active_category - active category * - action - form action * * @param array $params * @param Smarty $smarty * @return string */ function smarty_function_mobile_access_display_filter_list($params, &$smarty) { $active_category = array_var($params, 'active_object', new ProjectObject()); $variable_name = array_var($params, 'variable_name', 'category_id'); $smarty->assign(array("_mobile_access_display_categories_objects" => array_var($params, 'objects', null), "_mobile_access_display_categories_active_object" => $active_category, "_mobile_access_display_categories_variable_name" => $variable_name, "_mobile_access_display_categories_action" => array_var($params, 'action', '#'))); if (array_var($params, 'enable_categories', false)) { return $smarty->fetch(get_template_path('_display_filter_list', null, MOBILE_ACCESS_MODULE)); } else { return null; } // if }
/** * Show a list of objects * * Parameters: * * - comments - Array of objects that need to be listed * - id - div ID, if not present ID will be generated * - attachments_url_prefix - prefix for generated links for attachments * * @param array $params * @param Smarty $smarty * @return string */ function smarty_function_project_exporter_comments($params, &$smarty) { static $counter = 1; $id = array_var($params, 'id'); if (empty($id)) { $id = 'objects_list_' . $counter; $counter++; } // if $smarty->assign(array('_list_objects_comments' => array_var($params, 'comments'), '_list_objects_id' => $id, '_list_objects_attachments_url_prefix' => array_var($params, 'attachments_url_prefix'))); return $smarty->fetch(get_template_path('_project_exporter_comments', null, PROJECT_EXPORTER_MODULE)); }