function smarty_function_sugar_ajax_url($params, &$smarty)
{
    if (empty($params['url'])) {
        $smarty->trigger_error("ajax_url: missing required param (module)");
        return "";
    }
    return ajaxLink($params['url']);
}
Beispiel #2
0
 function menu($module, $offset, $isAuditEnabled, $saveAndContinue = false)
 {
     $html_text = "";
     if ($offset < 0) {
         $offset = 0;
     }
     //this check if require in cases when you visit the edit view before visiting that modules list view.
     //you can do this easily either from home, activities or sitemap.
     $stored_vcr_query = SugarVCR::retrieve($module);
     // bug 15893 - only show VCR if called as an element in a set of records
     if (!empty($_REQUEST['record']) and !empty($stored_vcr_query) and isset($_REQUEST['offset']) and (empty($_REQUEST['isDuplicate']) or $_REQUEST['isDuplicate'] == 'false')) {
         //syncing with display offset;
         $offset++;
         $action = !empty($_REQUEST['action']) ? $_REQUEST['action'] : 'EditView';
         $menu = SugarVCR::play($module, $offset);
         $list_link = '';
         if ($saveAndContinue && !empty($menu['NEXT'])) {
             $list_link = ajaxLink('index.php?action=' . $action . '&module=' . $module . '&record=' . $menu['NEXT'] . '&offset=' . ($offset + 1));
         }
         $previous_link = "";
         if (!empty($menu['PREV'])) {
             $previous_link = ajaxLink('index.php?module=' . $module . '&action=' . $action . '&offset=' . ($offset - 1) . '&record=' . $menu['PREV']);
         }
         $next_link = "";
         if (!empty($menu['NEXT'])) {
             $next_link = ajaxLink('index.php?module=' . $module . '&action=' . $action . '&offset=' . ($offset + 1) . '&record=' . $menu['NEXT']);
         }
         $ss = new Sugar_Smarty();
         $ss->assign('app_strings', $GLOBALS['app_strings']);
         $ss->assign('module', $module);
         $ss->assign('action', $action);
         $ss->assign('menu', $menu);
         $ss->assign('list_link', $list_link);
         $ss->assign('previous_link', $previous_link);
         $ss->assign('next_link', $next_link);
         $ss->assign('offset', $offset);
         $ss->assign('total', '');
         $ss->assign('plus', '');
         if (!empty($_SESSION[$module . 'total'])) {
             $ss->assign('total', $_SESSION[$module . 'total']);
             if (!empty($GLOBALS['sugar_config']['disable_count_query']) && ($_SESSION[$module . 'total'] - 1) % $GLOBALS['sugar_config']['list_max_entries_per_page'] == 0) {
                 $ss->assign('plus', '+');
             }
         }
         $html_text .= $ss->fetchCustom('include/EditView/SugarVCR.tpl');
     }
     return $html_text;
 }
function smarty_function_sugar_link($params, &$smarty)
{
    if (empty($params['module'])) {
        $smarty->trigger_error("sugar_link: missing 'module' parameter");
        return;
    }
    if (!empty($params['data']) && is_array($params['data'])) {
        $link_url = 'index.php?';
        $link_url .= 'module=iFrames&action=index';
        $link_url .= '&record=' . $params['data']['0'];
        $link_url .= '&tab=true';
    } else {
        $action = !empty($params['action']) ? $params['action'] : 'index';
        $link_url = 'index.php?';
        $link_url .= 'module=' . $params['module'] . '&action=' . $action;
        if (!empty($params['record'])) {
            $link_url .= "&record=" . $params['record'];
        }
        if (!empty($params['extraparams'])) {
            $link_url .= '&' . $params['extraparams'];
        }
    }
    if (isset($params['link_only']) && $params['link_only'] == 1) {
        // Let them just get the url, they want to put it someplace
        return ajaxLink($link_url);
    }
    $id = !empty($params['id']) ? ' id="' . $params['id'] . '"' : '';
    $class = !empty($params['class']) ? ' class="' . $params['class'] . '"' : '';
    $ico_class = !empty($params['ico_class']) ? '<i class="' . $params['ico_class'] . '"></i>' : '';
    $style = !empty($params['style']) ? ' style="' . $params['style'] . '"' : '';
    $title = !empty($params['title']) ? ' title="' . $params['title'] . '"' : '';
    $module = ' module="' . $params['module'] . '"';
    $accesskey = !empty($params['accesskey']) ? ' accesskey="' . $params['accesskey'] . '" ' : '';
    $options = !empty($params['options']) ? ' ' . $params['options'] . '' : '';
    if (!empty($params['data']) && is_array($params['data'])) {
        $label = $params['data']['4'];
    } elseif (!empty($params['label'])) {
        $label = $params['label'];
    } else {
        $label = !empty($GLOBALS['app_list_strings']['moduleList'][$params['module']]) ? $GLOBALS['app_list_strings']['moduleList'][$params['module']] : $params['module'];
    }
    $title = !empty($GLOBALS['app_list_strings']['moduleList'][$params['module']]) ? ' title="' . $GLOBALS['app_list_strings']['moduleList'][$params['module']] . '"' : '';
    $link = '<a href="' . ajaxLink($link_url) . '"' . $id . $class . $style . $options . $title . $module . '>' . $ico_class . '<span>' . $label . '</span>' . '</a>';
    return $link;
}
 public function testajaxLink()
 {
     global $sugar_config;
     $ajaxUIDisabled = isset($sugar_config['disableAjaxUI']) && $sugar_config['disableAjaxUI'];
     if (!$ajaxUIDisabled) {
         $this->assertSame('?action=ajaxui#ajaxUILoc=', ajaxLink(''));
         $testModules = array('Calendar', 'Emails', 'Campaigns', 'Documents', 'DocumentRevisions', 'Project', 'ProjectTask', 'EmailMarketing', 'CampaignLog', 'CampaignTrackers', 'Releases', 'Groups', 'EmailMan', "Administration", "ModuleBuilder", 'Schedulers', 'SchedulersJobs', 'DynamicFields', 'EditCustomFields', 'EmailTemplates', 'Users', 'Currencies', 'Trackers', 'Connectors', 'Import_1', 'Import_2', 'vCals', 'CustomFields', 'Roles', 'Audit', 'InboundEmail', 'SavedSearch', 'UserPreferences', 'MergeRecords', 'EmailAddresses', 'Relationships', 'Employees', 'Import', 'OAuthKeys');
         $bannedModules = ajaxBannedModules();
         foreach ($testModules as $module) {
             $uri = "index.php?module={$module}&action=detail&record=1";
             if (!in_array($module, $bannedModules)) {
                 $this->assertSame("?action=ajaxui#ajaxUILoc=" . urlencode($uri), ajaxLink($uri));
             } else {
                 $this->assertSame($uri, ajaxLink($uri));
             }
         }
     }
 }
Beispiel #5
0
    /**
     * getHelpText
     *
     * This is a protected function that returns the help text portion.  It is called from getModuleTitle.
     * We override the function from SugarView.php to make sure the create link only appears if the current user
     * meets the valid criteria.
     *
     * @param $module String the formatted module name
     * @return $theTitle String the HTML for the help text
     */
    protected function getHelpText($module)
    {
        $theTitle = '';
        if ($GLOBALS['current_user']->isAdminForModule('Users')) {
            $createImageURL = SugarThemeRegistry::current()->getImageURL('create-record.gif');
            $url = ajaxLink("index.php?module={$module}&action=EditView&return_module={$module}&return_action=DetailView");
            $theTitle = <<<EOHTML
&nbsp;
<img src='{$createImageURL}' alt='{$GLOBALS['app_strings']['LNK_CREATE']}'>
<a href="{$url}" class="utilsLink">
{$GLOBALS['app_strings']['LNK_CREATE']}
</a>
EOHTML;
        }
        return $theTitle;
    }
 /**
  * display header
  * @param boolean $controls display ui contol itmes
  */
 public function display_calendar_header($controls = true)
 {
     global $cal_strings;
     $ss = new Sugar_Smarty();
     $ss->assign("MOD", $cal_strings);
     $ss->assign("view", $this->cal->view);
     $ss->assign('print', $this->cal->isPrint());
     if ($controls) {
         $current_date = str_pad($this->cal->date_time->month, 2, '0', STR_PAD_LEFT) . "/" . str_pad($this->cal->date_time->day, 2, '0', STR_PAD_LEFT) . "/" . $this->cal->date_time->year;
         $tabs = $this->views;
         $tabs_params = array();
         foreach ($tabs as $key => $tab) {
             if ($key != "basicDay" and $key != "basicWeek") {
                 $tabs_params[$key]['title'] = $cal_strings["LBL_" . strtoupper($key)];
                 $tabs_params[$key]['id'] = $key . "-tab";
                 $tabs_params[$key]['link'] = "window.location.href='" . ajaxLink("index.php?module=Calendar&action=index&view=" . $key . $this->cal->date_time->get_date_str()) . "'";
             } else {
                 unset($tabs[$key]);
             }
         }
         $ss->assign('controls', $controls);
         $ss->assign('tabs', $tabs);
         $ss->assign('tabs_params', $tabs_params);
         $ss->assign('current_date', $current_date);
         $ss->assign('start_weekday', $GLOBALS['current_user']->get_first_day_of_week());
         $ss->assign('cal_img', SugarThemeRegistry::current()->getImageURL("jscalendar.gif", false));
     }
     $ss->assign('previous', $this->get_previous_calendar());
     $ss->assign('next', $this->get_next_calendar());
     $ss->assign('date_info', $this->get_date_info($this->cal->view, $this->cal->date_time));
     $header = get_custom_file_if_exists("modules/Calendar/tpls/header.tpl");
     echo $ss->fetch($header);
 }
/**
 * Handles displaying the header for classic view modules
 *
 * @param  $module      string  to next to the title.  Typically used for form buttons.
 * @param array $params optional, params to display in the breadcrumb, overriding SugarView::_getModuleTitleParams()
 * These should be in the form of array('label' => '<THE LABEL>', 'link' => '<HREF TO LINK TO>');
 * the first breadcrumb should be index at 0, and built from there e.g.
 * <code>
 * array(
 *    '<a href="index.php?module=Contacts&action=index">Contacts</a>',
 *    '<a href="index.php?module=Contacts&action=DetailView&record=123">John Smith</a>',
 *    'Edit',
 *    );
 * </code>
 * would display as:
 * <a href='index.php?module=Contacts&action=index'>Contacts</a> >> <a href='index.php?module=Contacts&action=DetailView&record=123'>John Smith</a> >> Edit   
 * @param  $show_help    boolean which determines if the print and help links are shown.
 * @return string HTML
 */
function getClassicModuleTitle($module, $params, $show_create, $index_url_override = "")
{
    global $sugar_version, $sugar_flavor, $server_unique_key, $current_language, $action;
    global $app_strings;
    $module_title = '';
    $count = count($params);
    $index = 0;
    $module = preg_replace("/ /", "", $module);
    $iconPath = "";
    $the_title = "<div class='moduleTitle'>\n<h2>";
    if (!empty($GLOBALS['app_list_strings']['moduleList'][$module])) {
        $moduleName = $GLOBALS['app_list_strings']['moduleList'][$module];
    } else {
        $moduleName = $module;
    }
    if (is_file(SugarThemeRegistry::current()->getImageURL('icon_' . $module . '_32.png', false))) {
        $iconPath = SugarThemeRegistry::current()->getImageURL('icon_' . $module . '_32.png');
    } else {
        if (is_file(SugarThemeRegistry::current()->getImageURL('icon_' . ucfirst($module) . '_32.png', false))) {
            $iconPath = SugarThemeRegistry::current()->getImageURL('icon_' . ucfirst($module) . '_32.png');
        }
    }
    if (!empty($iconPath)) {
        $url = !empty($index_url_override) ? $index_url_override : "index.php?module={$module}&action=index";
        array_unshift($params, "<a href='{$url}'><img src='{$iconPath}' " . "alt='" . $moduleName . "' title='" . $moduleName . "' align='absmiddle'></a>");
    }
    $new_params = array();
    $i = 0;
    foreach ($params as $value) {
        if (!is_null($value) && $value !== "") {
            $new_params[$i] = $value;
            $i++;
        }
    }
    if (SugarThemeRegistry::current()->directionality == "rtl") {
        $new_params = array_reverse($new_params);
    }
    $module_title = join(SugarView::getBreadCrumbSymbol(), $new_params);
    $the_title .= $module_title . "</h2>\n";
    if ($show_create) {
        $the_title .= "<span class='utils'>";
        $createRecordURL = SugarThemeRegistry::current()->getImageURL('create-record.gif');
        $url = ajaxLink("index.php?module={$module}&action=EditView&return_module={$module}&return_action=DetailView");
        $the_title .= <<<EOHTML
&nbsp;
<a href="{$url}" class="utilsLink">
<img src='{$createRecordURL}' alt='{$GLOBALS['app_strings']['LNK_CREATE']}'></a>
<a href="{$url}" class="utilsLink">
{$GLOBALS['app_strings']['LNK_CREATE']}
</a>
EOHTML;
        $the_title .= '</span>';
    }
    $the_title .= "</div>\n";
    return $the_title;
}
 function displayList(&$layout_def)
 {
     global $focus;
     $module = '';
     $record = '';
     if (isset($layout_def['varname'])) {
         $key = strtoupper($layout_def['varname']);
     } else {
         $key = $this->_get_column_alias($layout_def);
         $key = strtoupper($key);
     }
     if (empty($layout_def['fields'][$key])) {
         return "";
     } else {
         $value = $layout_def['fields'][$key];
     }
     if (empty($layout_def['target_record_key'])) {
         $record = $layout_def['fields']['ID'];
     } else {
         $record_key = strtoupper($layout_def['target_record_key']);
         $record = $layout_def['fields'][$record_key];
     }
     if (!empty($layout_def['target_module_key'])) {
         if (!empty($layout_def['fields'][strtoupper($layout_def['target_module_key'])])) {
             $module = $layout_def['fields'][strtoupper($layout_def['target_module_key'])];
         }
     }
     if (empty($module)) {
         if (empty($layout_def['target_module'])) {
             $module = $layout_def['module'];
         } else {
             $module = $layout_def['target_module'];
         }
     }
     //links to email module now need additional information.
     //this is to resolve the information about the target of the emails. necessitated by feature that allow
     //only on email record for the whole campaign.
     $parent = '';
     if (!empty($layout_def['parent_info'])) {
         if (!empty($focus)) {
             $parent = "&parent_id=" . $focus->id;
             $parent .= "&parent_module=" . $focus->module_dir;
         }
     } else {
         if (!empty($layout_def['parent_id'])) {
             if (isset($layout_def['fields'][strtoupper($layout_def['parent_id'])])) {
                 $parent .= "&parent_id=" . $layout_def['fields'][strtoupper($layout_def['parent_id'])];
             }
         }
         if (!empty($layout_def['parent_module'])) {
             if (isset($layout_def['fields'][strtoupper($layout_def['parent_module'])])) {
                 $parent .= "&parent_module=" . $layout_def['fields'][strtoupper($layout_def['parent_module'])];
             }
         }
     }
     $action = 'DetailView';
     $value = $layout_def['fields'][$key];
     global $current_user;
     if (!empty($record) && ($layout_def['DetailView'] && !$layout_def['owner_module'] || $layout_def['DetailView'] && !ACLController::moduleSupportsACL($layout_def['owner_module']) || ACLController::checkAccess($layout_def['owner_module'], 'view', $layout_def['owner_id'] == $current_user->id))) {
         $link = ajaxLink("index.php?module={$module}&action={$action}&record={$record}{$parent}");
         if ($module == 'EAPM') {
             $link = "index.php?module={$module}&action={$action}&record={$record}{$parent}";
         }
         return '<a href="' . $link . '" >' . "{$value}</a>";
     } else {
         return $value;
     }
 }
Beispiel #9
0
 /**
  * Get html of year calendar
  * @return string
  */
 protected function display_year()
 {
     $weekEnd1 = 0 - $this->startday;
     $weekEnd2 = -1 - $this->startday;
     if ($weekEnd1 < 0) {
         $weekEnd1 += 7;
     }
     if ($weekEnd2 < 0) {
         $weekEnd2 += 7;
     }
     $year_start = $GLOBALS['timedate']->fromString($this->cal->date_time->year . '-01-01');
     $str = "";
     $str .= '<table id="daily_cal_table" cellspacing="1" cellpadding="0" border="0" width="100%">';
     for ($m = 0; $m < 12; $m++) {
         $month_start = $year_start->get("+" . $m . " months");
         $month_start_ts = $month_start->format('U') + $month_start->getOffset();
         $month_end = $month_start->get("+" . $month_start->format('t') . " days");
         $week_start = CalendarUtils::get_first_day_of_week($month_start);
         $week_start_ts = $week_start->format('U') + $week_start->getOffset();
         // convert to timestamp, ignore tz
         $month_end_ts = $month_end->format('U') + $month_end->getOffset();
         $table_id = "daily_cal_table" . $m;
         //bug 47471
         if ($m % 3 == 0) {
             $str .= "<tr>";
         }
         $str .= '<td class="yearCalBodyMonth" align="center" valign="top" scope="row">';
         $str .= '<a class="yearCalBodyMonthLink" href="' . ajaxLink('index.php?module=Calendar&action=index&view=month&&hour=0&day=1&month=' . ($m + 1) . '&year=' . $GLOBALS['timedate']->fromTimestamp($month_start_ts)->format('Y')) . '">' . $GLOBALS['app_list_strings']['dom_cal_month_long'][$m + 1] . '</a>';
         $str .= '<table id="' . $table_id . '" cellspacing="1" cellpadding="0" border="0" width="100%">';
         $str .= '<tr class="monthCalBodyTH">';
         for ($d = 0; $d < 7; $d++) {
             $str .= '<th width="14%">' . $this->weekdays[$d] . '</th>';
         }
         $str .= '</tr>';
         $curr_time_global = $week_start_ts;
         $w = 0;
         while ($curr_time_global < $month_end_ts) {
             $str .= '<tr class="monthViewDayHeight yearViewDayHeight">';
             for ($d = 0; $d < 7; $d++) {
                 $curr_time = $week_start_ts + $d * 86400 + $w * 60 * 60 * 24 * 7;
                 if ($curr_time < $month_start_ts || $curr_time >= $month_end_ts) {
                     $monC = "";
                 } else {
                     $monC = '<a href="' . ajaxLink('index.php?module=Calendar&action=index&view=day&hour=0&day=' . $GLOBALS['timedate']->fromTimestamp($curr_time)->format('j') . '&month=' . $GLOBALS['timedate']->fromTimestamp($curr_time)->format('n') . '&year=' . $GLOBALS['timedate']->fromTimestamp($curr_time)->format('Y')) . '">' . $GLOBALS['timedate']->fromTimestamp($curr_time)->format('j') . '</a>';
                 }
                 if ($d == $weekEnd1 || $d == $weekEnd2) {
                     $str .= "<td class='weekEnd monthCalBodyWeekEnd'>";
                 } else {
                     $str .= "<td class='monthCalBodyWeekDay'>";
                 }
                 $str .= $monC;
                 $str .= "</td>";
             }
             $str .= "</tr>";
             $curr_time_global += 60 * 60 * 24 * 7;
             $w++;
         }
         $str .= '</table>';
         $str .= '</td>';
         if (($m - 2) % 3 == 0) {
             $str .= "</tr>";
         }
     }
     $str .= "</table>";
     return $str;
 }
 public function testCreatingFullLink()
 {
     $output = smarty_function_sugar_link(array('module' => 'Dog', 'action' => 'cat', 'id' => 'foo1', 'class' => 'foo4', 'style' => 'color:red;', 'title' => 'foo2', 'accesskey' => 'B', 'options' => 'scope="row"', 'label' => 'foo3'), $this->_smarty);
     $this->assertContains('<a href="' . ajaxLink('index.php?module=Dog&action=cat') . '" id="foo1" class="foo4" style="color:red;" scope="row" title="foo2" module="Dog">foo3</a>', $output);
 }
Beispiel #11
0
 function menu($module, $offset, $isAuditEnabled, $saveAndContinue = false)
 {
     $html_text = "";
     if ($offset < 0) {
         $offset = 0;
     }
     //this check if require in cases when you visit the edit view before visiting that modules list view.
     //you can do this easily either from home, activities or sitemap.
     $stored_vcr_query = SugarVCR::retrieve($module);
     if (!empty($_REQUEST['record']) and !empty($stored_vcr_query) and isset($_REQUEST['offset']) and (empty($_REQUEST['isDuplicate']) or $_REQUEST['isDuplicate'] == 'false')) {
         // bug 15893 - only show VCR if called as an element in a set of records
         //syncing with display offset;
         $offset++;
         $action = !empty($_REQUEST['action']) ? $_REQUEST['action'] : 'EditView';
         //$html_text .= "<tr class='pagination'>\n";
         //$html_text .= "<td COLSPAN=\"20\" style='padding: 0px;'>\n";
         $html_text .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr>\n";
         $list_URL = 'index.php?action=index&module=' . $module;
         $current_page = floor($offset / 20) * 20;
         $list_URL .= '&offset=' . $current_page;
         $menu = SugarVCR::play($module, $offset);
         if ($saveAndContinue) {
             if (!empty($menu['NEXT'])) {
                 $return_action = 'EditView';
                 $return_id = $menu['NEXT'];
                 $list_URL = ajaxLink('index.php?action=EditView&module=' . $module . '&record=' . $return_id . '&offset=' . ($offset + 1));
                 $list_link = "<button type='button' id='save_and_continue' class='button' title='{$GLOBALS['app_strings']['LBL_SAVE_AND_CONTINUE']}' onClick='this.form.action.value=\"Save\";if(check_form(\"EditView\")){sendAndRedirect(\"EditView\", \"{$GLOBALS['app_strings']['LBL_SAVING']} {$module}...\", \"{$list_URL}\");}'>" . $GLOBALS['app_strings']['LBL_SAVE_AND_CONTINUE'] . "</button>";
             } else {
                 $list_link = "";
             }
         } else {
             $list_link = "";
         }
         $previous_link = "";
         $next_link = "";
         if (!empty($menu['PREV'])) {
             //$previous_link = "<a href='index.php?module=$module&action=$action&offset=".($offset-1)."&record=".$menu['PREV']."' >".SugarThemeRegistry::current()->getImage("previous","border='0' align='absmiddle'",null,null,'.gif',$GLOBALS['app_strings']['LNK_LIST_PREVIOUS']).'&nbsp;'.$GLOBALS['app_strings']['LNK_LIST_PREVIOUS']."</a>";
             $href = ajaxLink("index.php?module={$module}&action={$action}&offset=" . ($offset - 1) . "&record=" . $menu['PREV']);
             $previous_link = "<button type='button' class='button' title='{$GLOBALS['app_strings']['LNK_LIST_PREVIOUS']}' onClick='document.location.href=\"{$href}\";'>" . SugarThemeRegistry::current()->getImage("previous", "border='0' align='absmiddle'", null, null, '.gif', $GLOBALS['app_strings']['LNK_LIST_PREVIOUS']) . "</button>";
         } else {
             $previous_link = "<button type='button' class='button' title='{$GLOBALS['app_strings']['LNK_LIST_PREVIOUS']}' disabled>" . SugarThemeRegistry::current()->getImage("previous_off", "border='0' align='absmiddle'", null, null, '.gif', $GLOBALS['app_strings']['LNK_LIST_PREVIOUS']) . "</button>";
         }
         if (!empty($menu['NEXT'])) {
             //$next_link = "<a href='index.php?module=$module&action=$action&offset=".($offset+1)."&record=".$menu['NEXT']."' >".$GLOBALS['app_strings']['LNK_LIST_NEXT'].'&nbsp;'.SugarThemeRegistry::current()->getImage("next","border='0' align='absmiddle'",null,null,'.gif',$GLOBALS['app_strings']['LNK_LIST_NEXT'])."</a>";
             $href = ajaxLink("index.php?module={$module}&action={$action}&offset=" . ($offset + 1) . "&record=" . $menu['NEXT']);
             $next_link = "<button type='button' class='button' title='{$GLOBALS['app_strings']['LNK_LIST_NEXT']}' onClick='document.location.href=\"{$href}\";'>" . SugarThemeRegistry::current()->getImage("next", "border='0' align='absmiddle'", null, null, '.gif', $GLOBALS['app_strings']['LNK_LIST_NEXT']) . "</button>";
         } else {
             $next_link = "<button type='button' class='button' title='{$GLOBALS['app_strings']['LNK_LIST_NEXT']}' disabled>" . SugarThemeRegistry::current()->getImage("next_off", "border='0' align='absmiddle'", null, null, '.gif', $GLOBALS['app_strings']['LNK_LIST_NEXT']) . "</button>";
         }
         if (!empty($_SESSION[$module . 'total'])) {
             $count = $offset . ' ' . $GLOBALS['app_strings']['LBL_LIST_OF'] . ' ' . $_SESSION[$module . 'total'];
             if (!empty($GLOBALS['sugar_config']['disable_count_query']) && ($_SESSION[$module . 'total'] - 1) % $GLOBALS['sugar_config']['list_max_entries_per_page'] == 0) {
                 $count .= '+';
             }
         } else {
             $count = $offset;
         }
         $html_text .= "<td nowrap class='paginationWrapper' >" . $list_link . "&nbsp;&nbsp;&nbsp;&nbsp;<span class='pagination'>" . $previous_link . "&nbsp;&nbsp;(" . $count . ")&nbsp;&nbsp;" . $next_link . "</span>&nbsp;&nbsp;</td>";
         $html_text .= "</tr></table>";
         //</td></tr>";
     }
     return $html_text;
 }
Beispiel #12
0
    /**
     * Return the "breadcrumbs" to display at the top of the page
     *
     * @param  bool $show_help optional, true if we show the help links
     * @return HTML string containing breadcrumb title
     */
    public function getModuleTitle($show_help = true)
    {
        global $sugar_version, $sugar_flavor, $server_unique_key, $current_language, $action;
        $theTitle = "<div class='moduleTitle'>\n<h2>";
        $module = preg_replace("/ /", "", $this->module);
        $params = $this->_getModuleTitleParams();
        $count = count($params);
        $index = 0;
        if (SugarThemeRegistry::current()->directionality == "rtl") {
            $params = array_reverse($params);
        }
        foreach ($params as $parm) {
            $index++;
            $theTitle .= $parm;
            if ($index < $count) {
                $theTitle .= $this->getBreadCrumbSymbol();
            }
        }
        $theTitle .= "</h2>\n";
        if ($show_help) {
            $theTitle .= "<span class='utils'>";
            $createImageURL = SugarThemeRegistry::current()->getImageURL('create-record.gif');
            $url = ajaxLink("index.php?module={$module}&action=EditView&return_module={$module}&return_action=DetailView");
            $theTitle .= <<<EOHTML
&nbsp;
<a href="{$url}" class="utilsLink">
<img src='{$createImageURL}' alt='{$GLOBALS['app_strings']['LNK_CREATE']}'></a>
<a href="{$url}" class="utilsLink">
{$GLOBALS['app_strings']['LNK_CREATE']}
</a>
EOHTML;
        }
        $theTitle .= "</span></div>\n";
        return $theTitle;
    }
Beispiel #13
0
function renderMain($data = [], $script = '')
{
    renderHeader();
    global $g_config;
    ?>
	<nav class="navbar navbar-default">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="index.php"><?php 
    echo $g_config['house']['name'];
    ?>
</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
          
          <ul class="nav navbar-nav navbar-right">
          	<li><a>Hi,<?php 
    echo $data['user']['name'];
    ?>
</a></li>
            <li><a href="<?php 
    echo ajaxLink('logout');
    ?>
">Logout</a></li>
          </ul>
        </div><!--/.nav-collapse -->
      </div>
    </nav>
    <div class="container">

      <!-- Main component for a primary marketing message or call to action -->
      
      <div class="row" >
      	<div class="page-header">
	        <h1>Member</h1>
	      </div>
      	<?php 
    foreach ($data['current_balance_user'] as $balance) {
        ?>
      	<div class="col-sm-4">
      		<div class="panel panel-primary">
            <div class="panel-heading">
              <h3 class="panel-title"><?php 
        echo $balance['name'];
        ?>
</h3>
            </div>
            <div class="panel-body">
              	<?php 
        if ($balance['balance'] > 0) {
            ?>
      				<h3 style="color:orange">Owned <strong>$<?php 
            printf('%.2f', $balance['balance']);
            ?>
</strong></h3>
	      		<?php 
        } elseif ($balance['balance'] < 0) {
            ?>
	      			<h3 style="color:red">Earned <strong>$<?php 
            printf('%.2f', -$balance['balance']);
            ?>
</strong></h3>
	      		<?php 
        } else {
            ?>
	      			<h3 style="color:green">You are clear!</h3>
	      		<?php 
        }
        ?>
            </div>
            <div class="panel-footer">
            	<?php 
        echo $balance['phone'];
        ?>
            </div>
          </div>

      		
      	</div>
      <?php 
    }
    ?>
  </div>
      <div class="row">
      <div class="col-md-6 ">
      	<div class="page-header">
	        <h1>Add</h1>
	      </div>
      	
      	<?php 
    if (array_key_exists('notice', $data)) {
        ?>
            <div class="alert alert-dismissible alert-<?php 
        echo $data['notice']['type'];
        ?>
">
                <button type="button" class="close" data-dismiss="alert">×</button>
                <p><?php 
        echo $data['notice']['message'];
        ?>
</p>
              </div>
          <?php 
    }
    ?>
      	      	<div class="col-md-12">
      		<form class="form-horizontal" method="post">
  <div class="form-group">
    <label  class="col-sm-2 control-label">Amount</label>
    <div class="col-sm-6">
      <input type="text" class="form-control" name="amount" autocomplete="off" value="<?php 
    echo $data['form']['amount'];
    ?>
">
    </div>
  </div>
  <div class="form-group">
    <label  class="col-sm-2 control-label">Description</label>
    <div class="col-sm-6">
      <input type="text" class="form-control" name="description" autocomplete="off" value="<?php 
    echo $data['form']['description'];
    ?>
">
    </div>
  </div>
  <div class="form-group">
    <label  class="col-sm-2 control-label">Who own</label>
    <div class="col-sm-6">
	    	<?php 
    foreach ($g_config['account'] as $u) {
        ?>
	    <label>
	      <input type="checkbox" name="payee_<?php 
        echo $u['account'];
        ?>
" <?php 
        if ($data['user']['name'] == $u['name']) {
            echo 'checked="true"';
        }
        ?>
 ><?php 
        echo $u['name'];
        ?>
	    </label>
	       <?php 
    }
    ?>
 	</div>
  </div>
  

  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-success">Add</button>
    </div>
  </div>
</form>
      	</div>
      </div>
            <div class="col-md-6">
      	<div class="page-header">
        <h1>Information</h1>
      </div>
      	<div class="col-md-12">

      		<dl class="dl-horizontal bg-primary">
			  <dt>Today</dt>
			  <dd><strong><?php 
    echo date("Y-m-d H:i:s a");
    ?>
</dd>
			  <dt>Current Total Balance</dt>
			  <dd><strong>$<?php 
    echo $data['current_balance'];
    ?>
</dd>
			</dl>
      		<h3 style="color:purple"></strong></h3>
      		<address>
			  <strong><?php 
    echo $g_config['house']['name'];
    ?>
</strong><br>
			  <?php 
    echo $g_config['house']['address'];
    ?>
<br>
			  <?php 
    echo $g_config['house']['city'] . ' ' . $g_config['house']['state'] . ' ' . $g_config['house']['zip'];
    ?>
<br>
			  
			</address>
      		<button class="btn btn-lg btn-success " id="clear-balance">Clear Balance</button>

      	</div>

      </div>
      </div>
<div class="row">
	<div class="page-header">
        <h1>Trend</h1>
      </div>
	
	<ul class="nav nav-tabs" role="tablist" id="chartm">
    <li role="presentation " class="active"><a href="#week" aria-controls="home" role="tab" data-toggle="tab">Week</a></li>
    <li role="presentation "><a href="#month" aria-controls="profile" role="tab" data-toggle="tab">Month</a></li>
    <li role="presentation "><a href="#year" aria-controls="messages" role="tab" data-toggle="tab">Year</a></li>
    
  </ul>

  <!-- Tab panes -->
  <div class="tab-content">
    <div role="tabpanel" class="tab-pane active" id="week"><canvas id="Total_week"></canvas></div>
    <div role="tabpanel" class="tab-pane" id="month"><canvas id="Total_month"></canvas></div>
    <div role="tabpanel" class="tab-pane" id="year"><canvas id="Total_year"></canvas></div>
    
  </div>

	

</div>
<div class="row">
	<div class="page-header">
        <h1>Detail Statement</h1>
      </div>
  	<div class="col-sm-12">
	<span class="label label-warning">Uncleared</span>
	<span class="label label-success">Cleared</span>
	<table class="table">
      <thead>
        <tr>
         
          <th>User</th>
          <th>Payee</th>
          <th>Amount</th>
          <th>Description</th>
          <th>Create Time</th>
          
          
          <th>Action</th>
        </tr>
      </thead>
      <tbody>
      	<?php 
    if (is_array($data['detail'])) {
        ?>
        <?php 
        foreach ($data['detail'] as $k) {
            ?>
        <?php 
            if ($k['is_finished'] == 0) {
                ?>
        	<tr class="warning">
        <?php 
            } else {
                ?>
        	<tr class="success">
        <?php 
            }
            ?>
        	
        	<td><?php 
            echo $g_config['account'][$k['user']]['name'];
            ?>
</td>
        	<td>
        	<?php 
            if ($k['payee'] == '') {
                echo "<span class='label label-danger'>Everyone</span>";
            } else {
                $pays = explode(":", $k['payee']);
                foreach ($pays as $p) {
                    if (array_key_exists($p, $g_config['account'])) {
                        echo '<span class="label label-success">' . $g_config['account'][$p]['name'] . '</span>  ';
                    } else {
                        echo "<span class='label label-default'>Unknown User</span>";
                    }
                }
            }
            ?>
        	</td>
        	<td>$<?php 
            echo $k['amount'];
            ?>
</td>
        	<td><?php 
            echo $k['description'];
            ?>
</td>
        	<td><?php 
            echo $k['create_time'] . " - " . date("D", strtotime($k['create_time']));
            ?>
</td>

        	<td>
        		<?php 
            if ($k['is_finished'] == 0 && $k['user'] == $data['user']['account']) {
                ?>
        		<button class="btn btn-danger btn-sm delete" data="<?php 
                echo $k['id'];
                ?>
">Del</button>
        		<?php 
            }
            ?>
        	</td>
        </tr>
    	<?php 
        }
        ?>
    <?php 
    }
    ?>
      </tbody>
    </table>
    </div>
    <div class="col-sm-12">
    	<nav>
  <ul class="pager">
  	<?php 
    if (intval($data['page']) > 0) {
        ?>
    	<li class="previous"><a href="index.php?page=<?php 
        echo $data['page'] - 1;
        ?>
">Newer<span aria-hidden="true">&larr;</span></a></li>
    <?php 
    }
    ?>
    <?php 
    if (intval($data['current_offset']) + $data['limit'] < data_count()) {
        ?>

    	<li class="next"><a href="index.php?page=<?php 
        echo intval($data['page']) + 1;
        ?>
">Older <span aria-hidden="true">&rarr;</span></a></li>
    <?php 
    }
    ?>
  </ul>
</nav>
    </div>
</div>
</div>
	<?php 
    renderFooter($script);
}