コード例 #1
0
ファイル: choose-template.php プロジェクト: robertpop/NS
    Ajax::outputError('You don\'t have access to this notification');
}
if (!($initData = $notify->getJSONContent())) {
    Ajax::output('Couldn\'t generate default JSON data!');
}
$initialData = json_decode($initData, true);
$saved = Notify::getByHash($hash);
$saved->flags |= Notify::FLAG_TEMPLATE_CHOSE;
$saved->template_id = $tempId;
$saved->save();
$template = new Templates($tempId);
$customize = new Customize($saved);
if (!($xmlTemplate = $template->getXmlContent())) {
    Ajax::outputError('Can\'t read template xml');
}
if (!($templateData = $customize->getDefaultData($xmlTemplate))) {
    Ajax::outputError('Template data couldn\'t be parsed');
}
foreach ($initialData['configs']['params'] as $k => $i) {
    if ($k != 'barStyle' && $k != 'barSymbol') {
        $templateData[$k] = $initialData['configs']['params'][$k];
    }
}
// E nevoie de lista de barStyle si barSymbol din XML-ul de configurare a template-ului, astfel incat in
// cazul unei teme custom sa se seteze barSymbol si barStyle ales de user doar daca tema curenta suporta
// tipul de barStyle si barSymbol ales la o tema precedenta (cand se schimba tema).
$templateParsedData = $template->getXmlContentParsed();
if (isset($templateParsedData) && isset($templateParsedData['configs'])) {
    $barStyleOptionsList = $templateParsedData['configs']['categories']['category']['params']['subcatButtonStyle']['params']['barStyle']['options']['option'];
    $barSymbolOptionsList = $templateParsedData['configs']['categories']['category']['params']['subcatButtonStyle']['params']['barSymbol']['options']['option'];
    // Lista de barStyle pentru template-ul curent.