function display()
 {
     global $current_language;
     if (empty($this->container_id)) {
         $child_reports = ReportContainer::get_root_reports();
     } else {
         $container = new ReportContainer();
         $container->retrieve($this->container_id);
         $child_reports = $container->get_linked_beans("reports", "ZuckerReport");
     }
     $mod_strings = return_module_language($current_language, "ZuckerReports");
     require_once 'include/ListView/ListView.php';
     $lv = new ListView();
     $lv->initNewXTemplate('modules/ZuckerReportContainer/DetailView.html', $mod_strings);
     $lv->xTemplateAssign("DELETE_INLINE_PNG", get_image($image_path . 'delete_inline.png', 'align="absmiddle" alt="' . $app_strings['LNK_DELETE'] . '" border="0"'));
     $lv->xTemplateAssign("EDIT_INLINE_PNG", get_image($image_path . 'edit_inline.png', 'align="absmiddle" alt="' . $app_strings['LNK_EDIT'] . '" border="0"'));
     $lv->xTemplateAssign("RETURN_URL", "&return_module=ZuckerReportContainer&return_action=DetailView&return_id=" . $container->id);
     $lv->setHeaderTitle("");
     $lv->setHeaderText("");
     ob_start();
     $lv->processListViewTwo($child_reports, "reports", "REPORT");
     $str = ob_get_clean();
     ob_end_flush();
     return parent::display() . $str;
 }
Example #2
0
 function process_page()
 {
     global $theme;
     global $mod_strings;
     global $app_strings;
     global $currentModule;
     global $current_language;
     global $current_module_strings;
     if (!is_file(sugar_cached('jsLanguage/WorkFlow/') . $GLOBALS['current_language'] . '.js')) {
         require_once 'include/language/jsLanguage.php';
         jsLanguage::createModuleStringsCache('WorkFlow', $GLOBALS['current_language']);
     }
     $javascript_language_files = getVersionedScript("cache/jsLanguage/WorkFlow/{$GLOBALS['current_language']}.js", $GLOBALS['sugar_config']['js_lang_version']);
     $current_module_strings = return_module_language($current_language, 'WorkFlowAlertShells');
     $ListView = new ListView();
     $header_text = '';
     if (isset($_REQUEST['workflow_id'])) {
         $workflow = BeanFactory::getBean('WorkFlow', $_REQUEST['workflow_id']);
         //TODO GET ALL ALERTS HERE
         //$focus_alerts_list = $workflow->get_linked_beans('wf_alerts','WorkFlowAlertShell');
         $alerts = BeanFactory::getBean('WorkFlowAlertShells');
         $current_module_strings = return_module_language($current_language, $alerts->module_dir);
         insert_popup_header($theme);
         $ListView->initNewXTemplate('modules/WorkFlowAlertShells/Popup_picker.html', $current_module_strings);
         $ListView->xTemplateAssign("WORKFLOW_ID", $workflow->id);
         $ListView->xTemplateAssign("JAVASCRIPT_LANGUAGE_FILES", $javascript_language_files);
         $ListView->xTemplateAssign("RETURN_URL", "&return_module=" . $currentModule . "&return_action=DetailView&return_id={$workflow->id}");
         $ListView->xTemplateAssign("EDIT_INLINE_PNG", SugarThemeRegistry::current()->getImage('edit_inline', 'align="absmiddle" border="0"', null, null, '.gif', $app_strings['LNK_EDIT']));
         $ListView->xTemplateAssign("DELETE_INLINE_PNG", SugarThemeRegistry::current()->getImage('delete_inline', 'align="absmiddle" border="0"', null, null, '.gif', $app_strings['LNK_REMOVE']));
         $ListView->setHeaderTitle($current_module_strings['LBL_MODULE_NAME_COMBO'] . $header_text);
         //$ListView->setHeaderText($button);
         //$ListView->setQuery("workflow_alertshells.alert_type = 'Email'","","", "ALERT");
         $list = $alerts->get_list("", "workflow_alertshells.alert_type = 'Email'");
         $display_list = $this->cullFromList($list['list'], $workflow->base_module, $workflow->type);
         $ListView->processListViewTwo($display_list, "main", "ALERT");
         insert_popup_footer();
     }
 }
 function process_page_for_merge()
 {
     global $theme;
     global $mod_strings;
     global $app_strings;
     global $currentModule;
     global $sugar_version, $sugar_config;
     $output_html = '';
     $where = '';
     $where = $this->_get_where_clause();
     $first_name = empty($_REQUEST['first_name']) ? '' : $_REQUEST['first_name'];
     $last_name = empty($_REQUEST['last_name']) ? '' : $_REQUEST['last_name'];
     $account_name = empty($_REQUEST['account_name']) ? '' : $_REQUEST['account_name'];
     $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true;
     $button = "<form action='index.php' method='post' name='form' id='form'>\n";
     //START:FOR MULTI-SELECT
     $multi_select = false;
     if (!empty($_REQUEST['mode']) && strtoupper($_REQUEST['mode']) == 'MULTISELECT') {
         $multi_select = true;
         $button .= "<input type='button' name='button' class='button' onclick=\"send_back_selected('Contacts',document.MassUpdate,'mass[]','" . $app_strings['ERR_NOTHING_SELECTED'] . "');\" title='" . $app_strings['LBL_SELECT_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_SELECT_BUTTON_KEY'] . "' value='  " . $app_strings['LBL_SELECT_BUTTON_LABEL'] . "  ' />\n";
     }
     //END:FOR MULTI-SELECT
     if (!$hide_clear_button) {
         $button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CLEAR_BUTTON_KEY'] . "' value='  " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . "  ' />\n";
     }
     $button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "' value='  " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . "  ' />\n";
     $button .= "</form>\n";
     $form = new XTemplate('modules/Contacts/MailMergePicker.html');
     $form->assign('MOD', $mod_strings);
     $form->assign('APP', $app_strings);
     $form->assign('THEME', $theme);
     $form->assign('MODULE_NAME', $currentModule);
     $form->assign('FIRST_NAME', $first_name);
     $form->assign('LAST_NAME', $last_name);
     $form->assign('ACCOUNT_NAME', $account_name);
     $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data'];
     $form->assign('request_data', $request_data);
     ob_start();
     insert_popup_header($theme);
     $output_html .= ob_get_contents();
     ob_end_clean();
     $output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false);
     $form->parse('main.SearchHeader');
     $output_html .= $form->text('main.SearchHeader');
     // Reset the sections that are already in the page so that they do not print again later.
     $form->reset('main.SearchHeader');
     // create the listview
     $seed_bean = new Contact();
     $ListView = new ListView();
     $ListView->display_header_and_footer = false;
     $ListView->show_export_button = false;
     $ListView->process_for_popups = true;
     $ListView->setXTemplate($form);
     $ListView->multi_select_popup = $multi_select;
     if ($multi_select) {
         $ListView->xTemplate->assign("TAG_TYPE", "SPAN");
     } else {
         $ListView->xTemplate->assign("TAG_TYPE", "A");
     }
     $ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']);
     $ListView->setQuery($where, '', 'contacts.last_name, contacts.first_name', 'CONTACT');
     $ListView->setModStrings($mod_strings);
     ob_start();
     $output_html .= get_form_header($mod_strings['LBL_LIST_FORM_TITLE'], $button, false);
     //BEGIN ATHENA CUSTOMIZATION - rsmith
     $query = $_REQUEST['select'] . ' WHERE ' . $_REQUEST['where'] . "'" . $_REQUEST['id'] . "'";
     //$response = $seed_bean->process_list_query($_REQUEST['select'], 0, -1, -1, $_REQUEST['where']."'".$_REQUEST['id']."'");
     $result = $seed_bean->db->query($query, true, "Error retrieving {$seed_bean->object_name} list: ");
     $list = array();
     while (($row = $seed_bean->db->fetchByAssoc($result)) != null) {
         $seed_bean = new Contact();
         foreach ($seed_bean->field_defs as $field => $value) {
             if (isset($row[$field])) {
                 $seed_bean->{$field} = $row[$field];
             } else {
                 if (isset($row[$seed_bean->table_name . '.' . $field])) {
                     $seed_bean->{$field} = $row[$seed_bean->table_name . '.' . $field];
                 } else {
                     $seed_bean->{$field} = "";
                 }
             }
         }
         $seed_bean->fill_in_additional_list_fields();
         $list[] = $seed_bean;
     }
     $ListView->processListViewTwo($list, 'main', 'CONTACT');
     //END ATHENA CUSTOMIZATION - rsmith
     $output_html .= ob_get_contents();
     ob_end_clean();
     $output_html .= insert_popup_footer();
     return $output_html;
 }
Example #4
0
$button .= "<input type='hidden' name='module' value='ZuckerReportContainer'>\n";
$button .= "<input type='hidden' name='action'>\n";
$button .= "<input type='hidden' name='record'>\n";
$button .= "<input type='hidden' name='parent_id'>\n";
if (!empty($container->id)) {
    $button .= "<input class='button' onclick='this.form.action.value=\"DetailView\"; this.form.record.value=\"" . $container->parent_id . "\"' type='submit' value=' " . $mod_strings['LBL_CONTAINER_UP'] . "  '>\n";
}
$button .= "<input name='name' size='20' maxlength='50' type='text'/>\n";
$button .= "<input class='button' onclick='this.form.action.value=\"New\"; this.form.parent_id.value=\"" . $container->id . "\"; return verify_container_data(this.form);' type='submit' value=' " . $mod_strings['LBL_CONTAINER_NEW'] . "  '>\n";
$button .= "</form>\n";
if (empty($container->id)) {
    $child_containers = ReportContainer::get_root_containers();
    $child_reports = ReportContainer::get_root_reports();
} else {
    $child_containers = $container->get_linked_beans("containers", "ReportContainer");
    $child_reports = $container->get_linked_beans("reports", "ZuckerReport");
}
$child_containers = SimpleTeams::filterBeanList($child_containers);
require_once 'include/ListView/ListView.php';
$lv = new ListView();
$lv->initNewXTemplate('modules/ZuckerReportContainer/DetailView.html', $mod_strings);
$lv->xTemplateAssign("DELETE_INLINE_PNG", get_image($image_path . 'delete_inline.png', 'align="absmiddle" alt="' . $app_strings['LNK_DELETE'] . '" border="0"'));
$lv->xTemplateAssign("EDIT_INLINE_PNG", get_image($image_path . 'edit_inline.png', 'align="absmiddle" alt="' . $app_strings['LNK_EDIT'] . '" border="0"'));
$lv->xTemplateAssign("RETURN_URL", "&return_module=ZuckerReportContainer&return_action=DetailView&return_id=" . $container->id);
$lv->setHeaderTitle($mod_strings['LBL_SUBCONTAINERS']);
$lv->setHeaderText($button);
$lv->processListViewTwo($child_containers, "containers", "CONTAINER");
$lv->setHeaderTitle($mod_strings['LBL_SUBREPORTS']);
$lv->setHeaderText("");
$lv->processListViewTwo($child_reports, "reports", "REPORT");
echo get_validate_js();
Example #5
0
 function execute($format = 'TABLE', $parameter_values = array())
 {
     global $sugar_config, $current_user, $current_language;
     global $beanList, $beanFiles;
     $beanName = $beanList[$this->mainmodule];
     $beanFile = $beanFiles[$beanName];
     if (!empty($beanName) && !empty($beanFile)) {
         require_once $beanFile;
         $seed = new $beanName();
         $filters = $this->get_filters();
         $sql_where = array();
         foreach ($filters as $filter) {
             $sql_where[] = $filter->create_where_clause($parameter_values);
         }
         $orders = $this->get_orders();
         $sql_order = array();
         foreach ($orders as $order) {
             $sql_order[] = $order->create_order_clause($parameter_values);
         }
         if ($this->filtertype == "AND") {
             $sql_join = " and ";
         } else {
             if ($this->filtertype == "OR") {
                 $sql_join = " or ";
             } else {
                 $sql_join = " and ";
             }
         }
         if (!empty($sql_join) && !empty($sql_where)) {
             $where_clause = "(" . join($sql_join, $sql_where) . ")";
         }
         if (!empty($sql_order)) {
             $order_clause = join(", ", $sql_order);
         }
         if (!empty($this->customwhere1)) {
             $where_clause = $this->customwhere1 . " " . $where_clause;
         }
         if (!empty($this->customwhere2)) {
             $where_clause = $where_clause . " " . $this->customwhere1;
         }
         $rows = $seed->get_full_list($order_clause, $where_clause);
         if (empty($rows)) {
             $rows = array();
         }
         $this->report_output .= "Found " . count($rows) . " rows<br/>";
         if ($format == "TABLE" || $format == "HTML" || $format == "SIMPLEHTML" || $format == "CSV") {
             $list_data = array();
             $list_fields = array();
             foreach ($rows as $row) {
                 $row_data = $row->get_list_view_data();
                 $row_data_mapped = array();
                 foreach (array_keys($row_data) as $key) {
                     $row_data_mapped[strtoupper($this->mainmodule) . "_" . $key] = $row_data[$key];
                 }
                 $list_data[] = new ListingRow($row_data_mapped);
                 if (empty($list_fields)) {
                     foreach (array_keys($row_data) as $key) {
                         $list_fields[] = $key;
                     }
                 }
             }
             if ($format == "HTML" || $format == "TABLE") {
                 if ($this->list_template == "default") {
                     require_once 'include/ListView/ListViewSmarty.php';
                     if (file_exists('custom/modules/' . $this->mainmodule . '/metadata/listviewdefs.php')) {
                         require_once 'custom/modules/' . $this->mainmodule . '/metadata/listviewdefs.php';
                     } else {
                         require_once 'modules/' . $this->mainmodule . '/metadata/listviewdefs.php';
                     }
                     $lv = new ListViewSmarty();
                     $displayColumns = array();
                     foreach ($listViewDefs[$this->mainmodule] as $col => $params) {
                         if (!empty($params['default']) && $params['default']) {
                             $displayColumns[$col] = $params;
                         }
                     }
                     $lv->displayColumns = $displayColumns;
                     $lv->setup($seed, 'include/ListView/ListViewGeneric.tpl', $where_clause, $params);
                     ob_start();
                     echo $lv->display();
                 } else {
                     require_once 'include/ListView/ListView.php';
                     $lv = new ListView();
                     if ($_REQUEST["is_scheduler"] = "true") {
                         $lv->setDisplayHeaderAndFooter(false);
                     }
                     $lv->initNewXTemplate('modules/ZuckerListingTemplate/lists/' . $this->list_template, return_module_language($current_language, $this->mainmodule));
                     $lv->xTemplateAssign("SITE_URL", $sugar_config["site_url"]);
                     ob_start();
                     $lv->processListViewTwo($list_data, "rows", "ROW");
                 }
                 if ($format == "HTML") {
                     $date = date("ymd_His");
                     $this->report_result_type = "FILE";
                     $this->report_result_name = $date . "_" . $this->name . ".html";
                     $this->report_result_name = strtolower(join("_", explode(" ", $this->report_result_name)));
                     $this->report_result = $this->archive_dir . "/" . $this->report_result_name;
                     $f = fopen($this->report_result, "w");
                     $c = file_get_contents("modules/ZuckerListingTemplate/lists/header.html");
                     $c = str_replace("{SITE_URL}", $sugar_config["site_url"], $c);
                     $c = str_replace("{THEME_URL}", $sugar_config["site_url"] . "/themes/" . $theme, $c);
                     fwrite($f, $c);
                     fwrite($f, ob_get_clean());
                     fwrite($f, file_get_contents("modules/ZuckerListingTemplate/lists/footer.html"));
                     fclose($f);
                 } else {
                     $this->report_result_type = "INLINE";
                     $this->report_result = ob_get_clean();
                 }
             } else {
                 if ($format == "SIMPLEHTML") {
                     $date = date("ymd_His");
                     $this->report_result_type = "FILE";
                     $this->report_result_name = $date . "_" . $this->name . ".html";
                     $this->report_result_name = strtolower(join("_", explode(" ", $this->report_result_name)));
                     $this->report_result = $this->archive_dir . "/" . $this->report_result_name;
                     $f = fopen($this->report_result, "w");
                     fwrite($f, "<!DOCTYPE html PUBLIC \"-//W3C//DTD html 4.01 Transitional//EN\">\n");
                     fwrite($f, "<html><body><table border=\"1\">");
                     if ($this->include_header && !empty($list_fields)) {
                         fwrite($f, "\n<tr>");
                         foreach ($list_fields as $col_name) {
                             fwrite($f, "<th>" . $col_name . "</th>");
                         }
                         fwrite($f, "</tr>");
                     }
                     foreach ($list_data as $list_row) {
                         fwrite($f, "\n<tr>");
                         foreach (array_keys($list_row->list_view_data) as $col_name) {
                             $field = $list_row->list_view_data[$col_name];
                             if (empty($field)) {
                                 fwrite($f, "<td>&nbsp;</td>");
                             } else {
                                 fwrite($f, "<td>" . $this->format_value_for_html($field) . "</td>");
                             }
                         }
                         fwrite($f, "</tr>");
                     }
                     fwrite($f, "\n</table></body></html>");
                     fclose($f);
                 } else {
                     if ($format == "CSV") {
                         $date = date("ymd_His");
                         $this->report_result_type = "FILE";
                         $this->report_result_name = $date . "_" . $this->name . ".csv";
                         $this->report_result_name = strtolower(join("_", explode(" ", $this->report_result_name)));
                         $this->report_result = $this->archive_dir . "/" . $this->report_result_name;
                         $f = fopen($this->report_result, "w");
                         if ($this->include_header && count($list_data) > 0) {
                             $row = $list_data[0];
                             foreach (array_keys($row->list_view_data) as $col_name) {
                                 fwrite($f, $col_name);
                                 fwrite($f, $this->col_delim);
                             }
                             fwrite($f, $this->row_delim);
                         }
                         foreach ($list_data as $list_row) {
                             foreach (array_keys($list_row->list_view_data) as $col_name) {
                                 $field = $list_row->list_view_data[$col_name];
                                 $pieces = explode("\n", $field);
                                 $cleaned_pieces = array();
                                 foreach ($pieces as $piece) {
                                     $cleaned_pieces[] = trim($piece);
                                 }
                                 fwrite($f, join(" ", $cleaned_pieces));
                                 if ($i != count($list_row->list_view_data) - 1) {
                                     fwrite($f, $this->col_delim);
                                 }
                             }
                             fwrite($f, $this->row_delim);
                         }
                         fclose($f);
                     }
                 }
             }
         } else {
             if ($format == "PROSPECTLIST") {
                 require_once "modules/ProspectLists/ProspectList.php";
                 $pl = new ProspectList();
                 $pl->name = empty($_REQUEST["prospect_list_name"]) ? $this->name : $_REQUEST["prospect_list_name"];
                 $pl->save();
                 foreach ($rows as $row) {
                     if ($row->object_name == "Contact") {
                         $pl->set_relationship('prospect_lists_prospects', array("related_type" => "Contacts", "related_id" => $row->id, 'prospect_list_id' => $pl->id));
                     } else {
                         if ($row->object_name == "Lead") {
                             $pl->set_relationship('prospect_lists_prospects', array("related_type" => "Leads", "related_id" => $row->id, 'prospect_list_id' => $pl->id));
                         } else {
                             if ($row->object_name == "Prospect") {
                                 $pl->set_relationship('prospect_lists_prospects', array("related_type" => "Prospects", "related_id" => $row->id, 'prospect_list_id' => $pl->id));
                             }
                         }
                     }
                 }
                 $this->report_result = "index.php?module=ProspectLists&action=DetailView&record=" . $pl->id;
                 $this->report_result_type = "FORWARD";
             }
         }
         $result = true;
     }
     return $result;
 }
Example #6
0
$button = "<form action='index.php' method='post' name='form' id='form'>\n";
if (!empty($container->id)) {
    $button .= "<input type='hidden' name='module' value='ZuckerReports'>\n";
    $button .= "<input type='hidden' name='action' value='PopupReportContainer'>\n";
    $button .= "<input type='hidden' name='record' value='" . $container->parent_id . "'>\n";
    $button .= "<input type='hidden' name='form' value='" . $_REQUEST['form'] . "'>\n";
    $button .= "<input class='button' type='submit' value=' " . $mod_strings['LBL_CONTAINER_UP'] . "  '>\n";
}
$button .= "<input class='button' LANGUAGE=javascript onclick=\"window.opener.document." . $_REQUEST['form'] . ".parent_name.value = '';window.opener.document." . $_REQUEST['form'] . ".parent_id.value = ''; window.close()\" type='submit' name='button' value='  " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . "  '>\n";
$button .= "<input class='button' LANGUAGE=javascript onclick=\"window.close()\" type='submit' name='button' value='  " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . "  '>\n";
$button .= "</form>\n";
$form->assign("SET_RETURN_JS", $the_javascript);
$form->assign("THEME", $theme);
$form->assign("IMAGE_PATH", $image_path);
$form->assign("MODULE_NAME", $currentModule);
$form->assign("FORM", $_REQUEST['form']);
insert_popup_header($theme);
$child_containers = $container->get_linked_beans("containers", "ReportContainer");
echo "\n<p>\n";
echo get_module_title("ZuckerReports", $mod_strings['LBL_CONTAINER'] . ": " . $container->name, false);
echo "\n</p>\n";
$lv = new ListView();
$lv->setXTemplate($form);
$lv->setHeaderTitle($mod_strings['LBL_SUBCONTAINERS']);
$lv->setHeaderText($button);
$lv->setModStrings($mod_strings);
$lv->processListViewTwo($child_containers, "main", "CONTAINER");
if (function_exists("get_form_footer")) {
    echo get_form_footer();
}
insert_popup_footer();
Example #7
0
 /* if the user is not a manager, get the user's self quota
  * and use a strip down version of ListView to process the
  * quota object
  */
 if (!$focus->isManager($current_user->id)) {
     $ListView->processListView($focus, "", "");
 } else {
     /* if records are available for the direct reports, 
      * get the group quota and process the ListView
      */
     if ($row_count > 0) {
         $groupQuota = $focus->getGroupQuota($_REQUEST['timeperiod_id']);
         $ListView->xTemplateAssign("GROUP_QUOTA", outputGroupQuota($focus->getGroupQuota($_REQUEST['timeperiod_id'], false)));
         $currency->getSelectOptions();
         $ListView->xTemplateAssign("JAVASCRIPT2", $currency->getJavascript());
         $ListView->processListViewTwo($focus, "main", "QUOTA");
     } else {
         $ListView->xTemplateAssign("NOQUOTA", $mod_strings['LBL_NO_QUOTAS_TIMEPERIOD']);
         $ListView->processListViewTwo($focus, "main", "");
     }
     ///////////////////////////////////////////////////////////////////////////////
     ////	QUOTAS MODULE EDIT VIEW
     $GLOBALS['log']->info("Quota edit view");
     $committed = '';
     $disabled = '';
     if ($focus->currency_id == NULL) {
         $selectCurrency = $currency->getSelectOptions();
     } else {
         $selectCurrency = $currency->getSelectOptions($focus->currency_id);
     }
     if (empty($_REQUEST['user_id'])) {