getters * *********************************************************************************************/ /************************************************************* * * get/set array key/values for new templates or default on install * *************************************************************/ function admin_template_get_values($tplType, $tplId, $tplValues, $arrayIdent){ /* in case we add some other template types one day */ if($tplType=='print' || $tplType=='emails'){ /* section/template values */ $tpl_args = array( 'tpl_type' => $tplType, 'tpl_id' => $tplId, 'tpl_values'=> $tplValues, ); $tpl_values = WPPIZZA()->order->orders_formatted(array(), $tpl_args, 'template_values_'.$tplId.''); } return $tpl_values; } /************************************************************* * * create admin markup of email/print templates * *************************************************************/ function admin_template($msgKey, $templateKey, $templateSetValues = false, $arrayIdent = 'templates'){ global $wppizza_options; /* get default for new template or use set values */ $tplVals = $this->admin_template_get_values($templateKey, $msgKey, $templateSetValues, $arrayIdent); /* re-sort sections as set for display in admin */ if(!empty($templateSetValues['sort'])){ $tpl_section_sort = array(); foreach($templateSetValues['sort'] as $section_key => $section ){ $tpl_section_sort[$section_key] = $tplVals['sections'][$section_key]; } /* now overwrite old order */ $tplVals['sections'] = $tpl_section_sort; } /* create markup */ $markup = ''; /** template div wrapper **/ $markup.=''; $markup.='
| '; $markup.=''; $markup.=' | '; } /** title/label internal **/ $markup.=''; $markup.=''; $markup.=' | '; /** format **/ $markup.=''; /*mail type */ $markup.=''; $markup.=' | '; /** email main recipients **/ if($templateKey=='emails'){ $markup.=''; $markup.=''.__('email recipients','wppizza-admin').':'; foreach($tplVals['recipients'] as $recKey=>$recTitle){ $markup.=''; } $markup.=''; $markup.=' | '; } /** email additional recipients **/ if($templateKey=='emails'){ $markup.=''; $markup.=''; $markup.=' | '; } /** email attachments **/ if($templateKey=='emails'){ $markup.=''; $markup.=''; $markup.=' | '; } /** edit, preview, locked etc right **/ $markup.=''; $icons = array(); /*icon edit*/ $icons['edit'] = ""; /*icon code edit (show css/style)*/ $icons['css'] = ''; /*icon preview*/ $icons['preview'] = ""; /*icon delete - only for template id's >0 to always keep default, filterable in case other plugins use templates that are not used otherwise*/ $prevent_delete = apply_filters('wppizza_prevent_template_delete', array(0), $templateKey); if(!in_array($msgKey, $prevent_delete )){ $icons['delete'] = ""; } /* allow adding / splicing icons before imploding for markup */ $icons = apply_filters('wppizza_filter_template_icons_'.$templateKey.'', $icons, $templateKey, $msgKey, $arrayIdent); $markup .= implode('',$icons); $markup.=' | '; $markup.='
| ';
/*
section on off and sort icon
*/
$markup.=' ';
$markup.='';
$markup.='';
$markup.='';
$markup.='';
$markup.='';//'.$section_key.'
$markup.='';
$markup.=' ';
/*
label enable wrap
*/
$markup.='';
/*
section header label on/off
*/
$markup.='';
$markup.=' ';
/*
drag/drop on/off variables
*/
$markup.='';
foreach($section['parameters'] as $section_value_key=>$section_value){
$markup.=' ';
$markup.='';
/*
drag/drop icon and hidden input to save selected order
regardless of whether checkbox was selected
*/
$markup.='';
$markup.='';//'.$section_value_key.'
$markup.='';
/*
checkbox with label
*/
$markup.='';
$markup.=' ';
}
$markup.=' | ';
}
$markup.='
| '; $markup.=''; if($templateKey=='emails'){ $markup.=''; $markup.=''; } $markup.=' | '; $markup.='
| ';
/*
label
*/
$markup.=' ';
$markup.=''.__('Section Styles','wppizza-admin').' - '.$section['labels']['label'].'';
$markup.=' ';
/*
style table
*/
$markup.='';
$markup.='';
$markup.='';
$markup.=' ';
/*
style header
*/
$markup.='';
$markup.='';
$markup.='';
$markup.=' ';
/*
style columns all
*/
$markup.='';
/**labels**/
if($section_key=='order'){
$markup.='';
}else{
$markup.='';
}
/**site vars have one td only**/
if($section_key=='site'){
$markup.=''.__('Column All','wppizza-admin').' ';
/*
style rows
*/
$markup.=''; $markup.=''; }else{ $markup.=' ';
$markup.=''.__('Left Column All','wppizza-admin').' ';
/*order vars have 3 columns*/
if($section_key=='order'){
$markup.=''; $markup.=''; $markup.=' ';
$markup.=''.__('Center Column All','wppizza-admin').' ';
}
$markup.=''; $markup.=''; $markup.=' ';
$markup.=''.__('Right Column All','wppizza-admin').' ';
}
$markup.=''; $markup.=''; $markup.=' ';
/*skip for order items*/
if($section_key != 'order'){
$markup.='';
foreach($section['parameters'] as $section_value_key=>$section_value){
$markup.=' ';
$markup.='';
$markup.= $section_value['label'].' ';
}
}
/* add styles for blogname and categories if displayed */
if($section_key=='order'){
$markup.='';
$markup.=''; $markup.='';//$tplVals['style'][$section_key][''.$section_value_key.'-tdall']//'.$section_value[''.$section_key.'-tdall'].' $markup.=' ';
$markup.=''.__('Blogname','wppizza-admin').' ';
$markup.=''; $markup.=''; $markup.=' ';
$markup.=''.__('Category','wppizza-admin').' ';
}
$markup.=''; $markup.=''; $markup.=' | ';
}
$markup.='
| ' . $template_contents . ' |
| '.PHP_EOL.''.implode(PHP_EOL,$tpl[$section_key]).' |
| '.PHP_EOL.''.implode(PHP_EOL,$tpl[$section_key]).' |
'.PHP_EOL;
$html.='
| '.PHP_EOL;
$html.='