function smarty_function_gymgr_select($params, Smarty_Internal_Template &$template) { $groups = GymManager::getInstance()->getGroups(); /* @var $tpl Smarty_Internal_Template */ $tpl = $template->smarty->createTemplate('gym/groups_select.tpl'); $tpl->assignByRef('gym_groups', $groups); $tpl->display(); }
function smarty_function_gym_exes_covers($params, Smarty_Internal_Template &$template) { $exes = GymManager::getInstance()->getExercises(); /* @var $tpl Smarty_Internal_Template */ $tpl = $template->smarty->createTemplate('gym/exercises_covers.tpl'); $tpl->assignByRef('exes', $exes); $tpl->display(); }
function smarty_block_exercise($params, $content, Smarty_Internal_Template &$template) { if (isEmpty($content)) { return; } $id = value_Array('id', $params); /* @var $ex GymEx */ $ex = GymManager::getInstance()->getExercise($id); $content = trim($content); $name = value_Array('name', $params); $name = $name ? $name : ($ex ? $ex->getName() : ''); $class = $ex ? GymManager::getInstance()->getClass($ex) : ''; $exTemplate = $template->smarty->createTemplate('gym/exercise.tpl'); $exTemplate->assign('c_id', IdHelper::gymExId($id)); $exTemplate->assign('c_name', $name); $exTemplate->assign('c_class', $class); $exTemplate->assign('c_body', $content); $exTemplate->display(); }
<?php require_once 'AjaxTools.php'; json_success(GymManager::getInstance()->getProgrammsAsArrays());
<?php require_once 'AjaxTools.php'; $programmId = RequestArrayAdapter::inst()->int('id'); $errorMsg = null; if (is_numeric($programmId)) { GymManager::getInstance()->deleteProgramm($programmId); } else { $errorMsg = 'Не передан id программы'; } if ($errorMsg) { json_error($errorMsg); } else { json_success('success'); }
<?php require_once 'AjaxTools.php'; $data = RequestArrayAdapter::inst()->arr('programm'); if ($data) { $programm = new GymProgramm($data); if ($programm->hasExercises()) { $programmId = GymManager::getInstance()->saveProgramm($programm); json_success($programmId); } else { json_error('Программа не содержит ни одного упражнения'); } } else { json_error('Не переданы данные'); }