s2dotemplates.php /// Art: Online Auftragsverwaltung /// Inhalt: Vorlagen /// Beschreibung: Alle Funktionen zu Vorlagen /// Benötigt: Alle, siehe init /// CCML-Parsing: notwendig /// ////////////////////////////////////////////////////////////////////////////////////////// /// /// Letzte Änderungen: /// ////////////////////////////////////////////////////////////////////////////////////////// ///<09.03.2008/6.0.1/> define('ROOT', './'); define('ASSETS', ROOT.'assets/'); require(ASSETS.'s2diconf.php'); require(CC_INCLUDE_INIT); if (!$session->is_shopadmin()) { $session->unset_client(); redirect(CC_URL_LOGIN); } require(CC_BLOGIC_CONFIG); $config = new config('templates'); //////////////////////////////////////////////////////////////////////////// // Template vorbereiten $template = new template(CC_TPL_OSTEMPLATES, true); $template->ressources(CC_INCLUDE_OSLANG); $template->show('templates'); $template->show('viewmenu'); $mailtemplate = new abstractdb(TABLE_TEMPLATES); // Template Variablen einlesen $active = 0; foreach(file(CC_INCLUDE_OSTEMPLATES) as $line) { $line = trim($line); if (strlen($line)) { if ($active) { if (preg_match("/^\[.*\]$/", $line)) { if (!preg_match("/^\[Template-Variables-.*\]$/", $line)) $active = 0; else $active++; } else if (preg_match("/^([a-z_]+)=(.*)$/", $line, $found)) if ($active == 1) $template->loop('var', array( 'var' => '{'.$found[2].'}', 'caption' => $found[2], )); else $template->loop('ordervar', array( 'var' => '{'.$found[2].'}', 'caption' => $found[2], )); else if (!preg_match("/^;/", $line, $found)) die('Error in file '.CC_INCLUDE_OSTEMPLATES.', unknown command "'.$line.'".'); } else if (preg_match("/^\[Template-Variables-.*\]$/", $line)) $active++; } } // Vorlagen einlesen while($t = $mailtemplate->get(array('*'), null, array('name asc'))) $template->loop('template', array( 'shortbody' => substr($t->body, 0, RESSOURCESCUT).(strlen($t->body) > RESSOURCESCUT ? ' ...' : ''), 'shortsubject' => substr($t->subject, 0, RESSOURCESCUT).(strlen($t->subject) > RESSOURCESCUT ? ' ...' : ''), 'shortname' => substr($t->name, 0, RESSOURCESCUT).(strlen($t->name) > RESSOURCESCUT ? ' ...' : ''), 'status' => $t->status, ), $t); // Status foreach ($orderstatus_ressources as $status => $status_long) $template->loop('status', array( 'short' => substr($s = $status_long, 0, STATUSCUT).(strlen($s) > STATUSCUT ? '...' : ''), 'long' => $status_long, 'status' => $status, 'img' => CC_ICON_OK, 'selected' => $config->status == $status ? 'selected="selected"' : '', )); // Template befüllen und fertig if (get(PARAMETER_MODE, CHECK_ALPHA) == 'new') $template->show('new'); $template->assign(array( '_headline1' => $template->vars['templates'], '_templates_selected' => 'selected', '_selected_entry' => $config->selected, '_template_x' => $config->x, '_template_y' => $config->y, )); $template->out(); ?>