private function GetMethodSettings($templateid = 0)
 {
     $settings = array();
     //$html = "";
     // get a list of each method
     $methods = ISC_ADMIN_EXPORTMETHOD_FACTORY::GetExportMethodList();
     foreach ($methods as $file => $details) {
         $method = ISC_ADMIN_EXPORTMETHOD_FACTORY::GetExportMethod($details['name']);
         if ($method->HasSettings()) {
             $settings[$details['name']] = $method->GetSettings($templateid);
         }
     }
     return $settings;
 }
Esempio n. 2
0
 private function StartExport()
 {
     $GLOBALS['ExportIntro'] = sprintf(GetLang("ExportIntro"), isc_strtolower($this->type_title));
     $GLOBALS['hiddenFields'] = sprintf("<input type='hidden' name='type' value='%s'>", $this->type);
     if (!isset($_GET['results'])) {
         unset($_SESSION['searchresults']);
     }
     $templateid = 0;
     if (isset($_GET["tempId"])) {
         $templateid = (int) $_GET["tempId"];
     }
     $GLOBALS['TemplateTitle'] = $this->title;
     try {
         $GLOBALS['TemplatesList'] = $this->BuildTemplatesSelect($this->type, $templateid);
         $where = "";
         $details = $this->filetype->GetTypeDetails();
         // were specific records selected?
         if (isset($_POST[$this->type])) {
             $ids = $_POST[$this->type];
         } elseif (isset($_REQUEST["ids"])) {
             $ids = explode(",", urldecode($_REQUEST["ids"]));
         }
         if (isset($ids)) {
             // get the id field for this type
             $idfield = $details['idfield'];
             $where = $idfield . " IN (" . implode(', ', array_map(array($GLOBALS['ISC_CLASS_DB'], "Quote"), $ids)) . ")";
             $GLOBALS['hiddenFields'] .= sprintf("<input type='hidden' name='ids' value='%s'>", implode(",", $ids));
         } elseif (isset($_REQUEST['searchId']) && $_REQUEST['searchId']) {
             // was a custom view/search used?
             $searchId = $_REQUEST['searchId'];
             $GLOBALS['hiddenFields'] .= sprintf("<input type='hidden' name='searchId' value='%s'>", $_REQUEST['searchId']);
             // get the where statement for this search
             $ret = $this->filetype->GetWhereFromSearch($searchId);
             $where = $ret["where"];
             //$GLOBALS['TemplateTitle'] .= " - " . $ret['name'];
         } else {
             //$GLOBALS['TemplateTitle'] .= " - " . sprintf(GetLang("AllData"), ucfirst($this->type));
             $params = $this->GetParams();
             if (count($params)) {
                 $GLOBALS['hiddenFields'] .= sprintf("<input type='hidden' name='params' value='%s'>", http_build_query($params));
                 $where = $this->filetype->GetWhereFromParams($params);
             }
         }
         // Generate the grid
         $GLOBALS['GridData'] = $this->GetGrid($where);
         $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("export.grid");
         $GLOBALS['DataGrid'] = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
         if (isset($_REQUEST['ajax'])) {
             echo $GLOBALS['DataGrid'];
             die;
         }
         // create a list of methods the user can choose from
         $methods = ISC_ADMIN_EXPORTMETHOD_FACTORY::GetExportMethodList();
         $method_list = "";
         $GLOBALS['MethodChecked'] = "checked=\"checked\"";
         foreach ($methods as $file => $method) {
             //$GLOBALS['MethodIcon'] = $method['icon'];
             $GLOBALS['MethodName'] = $method['name'];
             $GLOBALS['MethodTitle'] = $method['title'];
             $GLOBALS['MethodHelp'] = $method['help'];
             $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("export.method");
             $method_list .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
             $GLOBALS['MethodChecked'] = "";
         }
         $GLOBALS['Methods'] = $method_list;
         $GLOBALS['ViewLink'] = $details['viewlink'];
     } catch (Exception $ex) {
         FlashMessage($ex->getMessage(), MSG_ERROR);
         $GLOBALS['HideForm'] = "display: none;";
     }
     $GLOBALS['Message'] = GetFlashMessageBoxes();
     $GLOBALS['FormAction'] = "runExport&t=" . $this->type;
     $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("export.step1");
     $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate();
 }
Esempio n. 3
0
	private function StartExport()
	{
		$GLOBALS['ExportIntro'] = sprintf(GetLang("ExportIntro"), isc_strtolower($this->type_title));
		$GLOBALS['hiddenFields'] = sprintf("<input type='hidden' name='type' value='%s'>", $this->type);

		$templateid = 0;
		if (isset($_GET["tempId"])) {
			$templateid = (int)$_GET["tempId"];
		}

		$GLOBALS['TemplateTitle'] = $this->title;

		try {
			$GLOBALS['TemplatesList'] = $this->BuildTemplatesSelect($this->type, $templateid);

			$where = "";
			$having = "";

			$details = $this->filetype->GetTypeDetails();

			if (!empty($details['instructions'])) {
				FlashMessage($details['instructions'], MSG_WARNING);
			}

			// were specific records selected?
			if (isset($_REQUEST[$this->type])) {
				$ids = $_REQUEST[$this->type];
			}
			elseif (isset($_REQUEST["ids"])) {
				$ids = explode(",", urldecode($_REQUEST["ids"]));
			}

			if (isset($ids)) {
				// get the id field for this type
				$idfield = $details['idfield'];

				$where = $idfield . " IN (" . implode(', ', array_map(array($GLOBALS['ISC_CLASS_DB'], "Quote"), $ids)) . ")";

				$GLOBALS['hiddenFields'] .= sprintf("<input type='hidden' name='ids' value='%s'>", implode(",", $ids));
			}
			else {
				//$GLOBALS['TemplateTitle'] .= " - " . sprintf(GetLang("AllData"), ucfirst($this->type));
				$params = $this->GetParams();
				if (!empty($params)) {
					$GLOBALS['hiddenFields'] .= sprintf("<input type='hidden' name='params' value='%s'>", http_build_query($params));

					$ret = $this->filetype->BuildWhereFromFields($params);

					if (is_array($ret)) {
						$where = $ret['where'];
						if (isset($ret['having'])) {
							$having = $ret['having'];
						}
					}
					else {
						$where = $ret;
					}
				}
			}

			// Generate the grid
			$GLOBALS['GridData'] = $this->GetGrid($where, $having);
			$GLOBALS['DataGrid'] = $this->template->render('export.grid.tpl');

			if (isset($_REQUEST['ajax'])) {
				echo $GLOBALS['DataGrid'];
				die;
			}

			// create a list of methods the user can choose from
			$methods = ISC_ADMIN_EXPORTMETHOD_FACTORY::GetExportMethodList();
			$method_list = "";

			$GLOBALS['MethodChecked'] = "checked=\"checked\"";

			foreach ($methods as $file => $method) {
				//$GLOBALS['MethodIcon'] = $method['icon'];
				$GLOBALS['MethodName'] = $method['name'];
				$GLOBALS['MethodTitle'] = $method['title'];
				$GLOBALS['MethodHelp'] = $method['help'];

				$method_list .= $this->template->render('export.method.tpl');

				$GLOBALS['MethodChecked'] = "";
			 }

			 $GLOBALS['Methods'] = $method_list;

			 $GLOBALS['ViewLink'] = $details['viewlink'];
		}
		catch (Exception $ex) {
			FlashMessage($ex->getMessage(), MSG_ERROR);

			$GLOBALS['HideForm'] = "display: none;";
		}

		$GLOBALS['Message'] = GetFlashMessageBoxes();
		$GLOBALS['FormAction'] = "runExport&t=" . $this->type;

		$this->template->display('export.step1.tpl');
	}