parent
2f3d007cb0
commit
cc152ca3ef
@ -0,0 +1,3 @@ |
||||
nbproject/* |
||||
Resources/public/vendor/* |
||||
Resources/docs/apidoc |
@ -0,0 +1,16 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\ThemeBundle; |
||||
|
||||
use Chamilo\ThemeBundle\DependencyInjection\AssetsCompilerPass; |
||||
use Symfony\Component\HttpKernel\Bundle\Bundle; |
||||
|
||||
/** |
||||
* Class ChamiloThemeBundle |
||||
* @package Chamilo\ThemeBundle |
||||
*/ |
||||
class ChamiloThemeBundle extends Bundle |
||||
{ |
||||
|
||||
} |
@ -0,0 +1,82 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\ThemeBundle\Controller; |
||||
|
||||
use Chamilo\ThemeBundle\Event\SidebarMenuEvent; |
||||
use Chamilo\ThemeBundle\Event\SidebarMenuKnpEvent; |
||||
use Chamilo\ThemeBundle\Event\ThemeEvents; |
||||
use Chamilo\ThemeBundle\Model\MenuItemInterface; |
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
||||
use Symfony\Component\HttpFoundation\Request; |
||||
use Symfony\Component\HttpFoundation\Response; |
||||
|
||||
/** |
||||
* Controller to handle breadcrumb display inside the layout |
||||
* |
||||
*/ |
||||
class BreadcrumbController extends Controller { |
||||
|
||||
|
||||
/** |
||||
* Controller Reference action to be called inside the layout. |
||||
* |
||||
* Triggers the {@link ThemeEvents::THEME_BREADCRUMB} to receive the currently active menu chain. |
||||
* |
||||
* If there are no listeners attached for this event, the return value is an empty response. |
||||
* |
||||
* @param Request $request |
||||
* @param string $title |
||||
* |
||||
* @return Response |
||||
* |
||||
*/ |
||||
public function breadcrumbAction(Request $request, $title = '') |
||||
{ |
||||
if (!$this->getDispatcher()->hasListeners(ThemeEvents::THEME_BREADCRUMB)) { |
||||
return new Response(); |
||||
} |
||||
|
||||
$active = $this->getDispatcher()->dispatch( |
||||
ThemeEvents::THEME_BREADCRUMB, |
||||
new SidebarMenuKnpEvent($request) |
||||
)->getActive(); |
||||
|
||||
/** @var $active MenuItemInterface */ |
||||
//var_dump($request->get('course')); exit; |
||||
//$active->addChild() |
||||
|
||||
/*$active->addChild( |
||||
'Courses', |
||||
array( |
||||
'route' => 'admin_chamilo_core_course_list', |
||||
'routeParameters' => array(), |
||||
array("attributes" => array("id" => 'nav')) |
||||
) |
||||
);*/ |
||||
|
||||
$list = array(); |
||||
if ($active) { |
||||
$list[] = $active; |
||||
while(null !== ($item = $active->getActiveChild())) { |
||||
$list[] = $item; |
||||
$active = $item; |
||||
} |
||||
} |
||||
|
||||
return $this->render('ChamiloThemeBundle:Breadcrumb:breadcrumb.html.twig', array( |
||||
'active' => $list, |
||||
'title' => $title |
||||
)); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* @return EventDispatcher |
||||
*/ |
||||
protected function getDispatcher() |
||||
{ |
||||
return $this->get('event_dispatcher'); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,51 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\ThemeBundle\Controller; |
||||
|
||||
use Chamilo\ThemeBundle\Form\FormDemoModelType; |
||||
use Chamilo\ThemeBundle\Model\FormDemoModel; |
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; |
||||
|
||||
/** |
||||
* Class DefaultController |
||||
* |
||||
* @package Chamilo\ThemeBundle\Controller |
||||
*/ |
||||
class DefaultController extends Controller |
||||
{ |
||||
/** |
||||
* @Template() |
||||
*/ |
||||
public function indexAction() |
||||
{ |
||||
return array(); |
||||
} |
||||
|
||||
/** |
||||
* @return \Symfony\Component\HttpFoundation\Response |
||||
*/ |
||||
public function dashboardAction() { |
||||
return $this->render('ChamiloThemeBundle:Default:index.html.twig'); |
||||
} |
||||
|
||||
/** |
||||
* @return \Symfony\Component\HttpFoundation\Response |
||||
*/ |
||||
public function uiGeneralAction() { |
||||
return $this->render('ChamiloThemeBundle:Default:index.html.twig'); |
||||
} |
||||
|
||||
public function uiIconsAction() { |
||||
return $this->render('ChamiloThemeBundle:Default:index.html.twig'); |
||||
} |
||||
|
||||
public function formAction() { |
||||
$form =$this->createForm( new FormDemoModelType()); |
||||
return $this->render('ChamiloThemeBundle:Default:form.html.twig', array( |
||||
'form' => $form->createView() |
||||
)); |
||||
} |
||||
} |
@ -0,0 +1,64 @@ |
||||
<?php |
||||
/** |
||||
* ExceptionController.php |
||||
* avanzu-admin |
||||
* Date: 01.03.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Controller; |
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference; |
||||
|
||||
use Symfony\Component\HttpFoundation\Request; |
||||
|
||||
class ExceptionController extends \Symfony\Bundle\TwigBundle\Controller\ExceptionController { |
||||
|
||||
|
||||
/** |
||||
* @param Request $request |
||||
* @param string $format |
||||
* @param int $code |
||||
* @param bool $debug |
||||
* |
||||
* @return TemplateReference |
||||
*/ |
||||
protected function findTemplate(Request $request, $format, $code, $debug) |
||||
{ |
||||
|
||||
if(strpos($request->getPathInfo(), '/admin') !== 0) { |
||||
return parent::findTemplate($request, $format, $code, $debug); |
||||
} |
||||
|
||||
$name = $debug ? 'exception' : 'error'; |
||||
if ($debug && 'html' == $format) { |
||||
$name = 'exception_full'; |
||||
} |
||||
|
||||
// when not in debug, try to find a template for the specific HTTP status code and format |
||||
if (!$debug) { |
||||
$template = new TemplateReference('ChamiloThemeBundle', 'Exception', $name.$code, $format, 'twig'); |
||||
if ($this->templateExists($template)) { |
||||
return $template; |
||||
} |
||||
} |
||||
|
||||
// try to find a template for the given format |
||||
$template = new TemplateReference('ChamiloThemeBundle', 'Exception', $name, $format, 'twig'); |
||||
if ($this->templateExists($template)) { |
||||
return $template; |
||||
} |
||||
|
||||
// default to a generic HTML exception |
||||
$request->setRequestFormat('html'); |
||||
|
||||
$template = new TemplateReference('ChamiloThemeBundle', 'Exception', $name, 'html', 'twig'); |
||||
if ($this->templateExists($template)) { |
||||
return $template; |
||||
} |
||||
|
||||
return parent::findTemplate($request, $format, $code, $debug); |
||||
|
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,95 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\ThemeBundle\Controller; |
||||
|
||||
use Chamilo\ThemeBundle\Event\MessageListEvent; |
||||
use Chamilo\ThemeBundle\Event\NotificationListEvent; |
||||
use Chamilo\ThemeBundle\Event\ShowUserEvent; |
||||
use Chamilo\ThemeBundle\Event\TaskListEvent; |
||||
use Chamilo\ThemeBundle\Event\ThemeEvents; |
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
||||
use Symfony\Component\EventDispatcher\EventDispatcher; |
||||
use Symfony\Component\HttpFoundation\Response; |
||||
|
||||
class NavbarController extends Controller |
||||
{ |
||||
|
||||
/** |
||||
* @return EventDispatcher |
||||
*/ |
||||
protected function getDispatcher() |
||||
{ |
||||
return $this->get('event_dispatcher'); |
||||
} |
||||
|
||||
public function notificationsAction($max = 5) |
||||
{ |
||||
if (!$this->getDispatcher()->hasListeners(ThemeEvents::THEME_NOTIFICATIONS)) { |
||||
return new Response(); |
||||
} |
||||
|
||||
$listEvent = $this->getDispatcher()->dispatch(ThemeEvents::THEME_NOTIFICATIONS, new NotificationListEvent()); |
||||
|
||||
return $this->render( |
||||
'ChamiloThemeBundle:Navbar:notifications.html.twig', |
||||
array( |
||||
'notifications' => $listEvent->getNotifications(), |
||||
'total' => $listEvent->getTotal(), |
||||
) |
||||
); |
||||
|
||||
} |
||||
|
||||
public function messagesAction($max = 5) |
||||
{ |
||||
|
||||
if (!$this->getDispatcher()->hasListeners(ThemeEvents::THEME_MESSAGES)) { |
||||
return new Response(); |
||||
} |
||||
|
||||
$listEvent = $this->getDispatcher()->dispatch(ThemeEvents::THEME_MESSAGES, new MessageListEvent()); |
||||
|
||||
return $this->render( |
||||
'ChamiloThemeBundle:Navbar:messages.html.twig', |
||||
array( |
||||
'messages' => $listEvent->getMessages(), |
||||
'total' => $listEvent->getTotal(), |
||||
) |
||||
); |
||||
} |
||||
|
||||
public function tasksAction($max = 5) |
||||
{ |
||||
|
||||
if (!$this->getDispatcher()->hasListeners(ThemeEvents::THEME_TASKS)) { |
||||
return new Response(); |
||||
} |
||||
$listEvent = $this->getDispatcher()->dispatch(ThemeEvents::THEME_TASKS, new TaskListEvent()); |
||||
|
||||
return $this->render( |
||||
'ChamiloThemeBundle:Navbar:tasks.html.twig', |
||||
array( |
||||
'tasks' => $listEvent->getTasks(), |
||||
'total' => $listEvent->getTotal(), |
||||
) |
||||
); |
||||
} |
||||
|
||||
public function userAction() |
||||
{ |
||||
|
||||
if (!$this->getDispatcher()->hasListeners(ThemeEvents::THEME_NAVBAR_USER)) { |
||||
return new Response(); |
||||
} |
||||
$userEvent = $this->getDispatcher()->dispatch(ThemeEvents::THEME_NAVBAR_USER, new ShowUserEvent()); |
||||
|
||||
return $this->render( |
||||
'ChamiloThemeBundle:Navbar:user.html.twig', |
||||
array( |
||||
'user' => $userEvent->getUser(), |
||||
) |
||||
); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,46 @@ |
||||
<?php |
||||
/** |
||||
* SecurityController.php |
||||
* avanzu-admin |
||||
* Date: 23.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Controller; |
||||
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
||||
use Symfony\Component\HttpFoundation\Request; |
||||
use Symfony\Component\Security\Core\SecurityContext; |
||||
|
||||
class SecurityController extends Controller |
||||
{ |
||||
|
||||
/** |
||||
* @param Request $request |
||||
* |
||||
* @return \Symfony\Component\HttpFoundation\Response |
||||
*/ |
||||
public function loginAction(Request $request) |
||||
{ |
||||
$session = $request->getSession(); |
||||
|
||||
// get the login error if there is one |
||||
if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) { |
||||
$error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR); |
||||
} else { |
||||
$error = $session->get(SecurityContext::AUTHENTICATION_ERROR); |
||||
$session->remove(SecurityContext::AUTHENTICATION_ERROR); |
||||
} |
||||
|
||||
return $this->render( |
||||
'ChamiloThemeBundle:Security:login.html.twig', |
||||
array( |
||||
'last_username' => $session->get( |
||||
SecurityContext::LAST_USERNAME |
||||
), |
||||
'error' => $error, |
||||
) |
||||
); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,107 @@ |
||||
<?php |
||||
/** |
||||
* SidebarController.php |
||||
* avanzu-admin |
||||
* Date: 23.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Controller; |
||||
|
||||
use Chamilo\ThemeBundle\Event\ShowUserEvent; |
||||
use Chamilo\ThemeBundle\Event\SidebarMenuEvent; |
||||
use Chamilo\ThemeBundle\Event\SidebarMenuKnpEvent; |
||||
use Chamilo\ThemeBundle\Event\ThemeEvents; |
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
||||
use Symfony\Component\HttpFoundation\Request; |
||||
use Symfony\Component\HttpFoundation\Response; |
||||
|
||||
/** |
||||
* Class SidebarController |
||||
* @package Chamilo\ThemeBundle\Controller |
||||
*/ |
||||
class SidebarController extends Controller |
||||
{ |
||||
/** |
||||
* "Hello user" section |
||||
* @return Response |
||||
*/ |
||||
public function userPanelAction() |
||||
{ |
||||
if (!$this->getDispatcher()->hasListeners(ThemeEvents::THEME_SIDEBAR_USER)) { |
||||
return new Response(); |
||||
} |
||||
|
||||
$userEvent = $this->getDispatcher()->dispatch(ThemeEvents::THEME_SIDEBAR_USER, new ShowUserEvent()); |
||||
|
||||
return $this->render( |
||||
'ChamiloThemeBundle:Sidebar:user-panel.html.twig', |
||||
array( |
||||
'user' => $userEvent->getUser() |
||||
) |
||||
); |
||||
} |
||||
|
||||
/** |
||||
* Search bar |
||||
* @return Response |
||||
*/ |
||||
public function searchFormAction() |
||||
{ |
||||
return $this->render('ChamiloThemeBundle:Sidebar:search-form.html.twig', array()); |
||||
} |
||||
|
||||
/** |
||||
* @return EventDispatcher |
||||
*/ |
||||
protected function getDispatcher() |
||||
{ |
||||
return $this->get('event_dispatcher'); |
||||
} |
||||
|
||||
/** |
||||
* @param Request $request |
||||
* @return Response |
||||
*/ |
||||
public function menuAction(Request $request) |
||||
{ |
||||
if (!$this->getDispatcher()->hasListeners(ThemeEvents::THEME_SIDEBAR_SETUP_MENU)) { |
||||
return new Response(); |
||||
} |
||||
|
||||
$event = $this->getDispatcher()->dispatch( |
||||
ThemeEvents::THEME_SIDEBAR_SETUP_MENU, |
||||
new SidebarMenuEvent($request) |
||||
); |
||||
|
||||
return $this->render( |
||||
'ChamiloThemeBundle:Sidebar:menu.html.twig', |
||||
array( |
||||
'menu' => $event->getItems() |
||||
) |
||||
); |
||||
} |
||||
|
||||
/** |
||||
* @param Request $request |
||||
* @return Response |
||||
*/ |
||||
public function menuKnpAction(Request $request) |
||||
{ |
||||
if (!$this->getDispatcher()->hasListeners(ThemeEvents::THEME_SIDEBAR_SETUP_MENU_KNP)) { |
||||
return new Response(); |
||||
} |
||||
|
||||
/** @var SidebarMenuKnpEvent $event */ |
||||
$event = $this->getDispatcher()->dispatch( |
||||
ThemeEvents::THEME_SIDEBAR_SETUP_MENU_KNP, |
||||
new SidebarMenuKnpEvent($request) |
||||
); |
||||
|
||||
return $this->render( |
||||
'ChamiloThemeBundle:Sidebar:menu_knp.html.twig', |
||||
array( |
||||
'menu' => $event->getMenu() |
||||
) |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,30 @@ |
||||
<?php |
||||
/** |
||||
* WidgetController.php |
||||
* avanzu-admin |
||||
* Date: 16.03.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Controller; |
||||
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
||||
use Symfony\Component\HttpFoundation\Request; |
||||
use Symfony\Component\HttpFoundation\Response; |
||||
|
||||
class WidgetController extends Controller { |
||||
|
||||
public function defaultBoxAction() { |
||||
|
||||
|
||||
|
||||
} |
||||
|
||||
public function solidBoxAction() {} |
||||
|
||||
public function tiledBoxAction() {} |
||||
|
||||
public function smallBoxAction() {} |
||||
|
||||
|
||||
} |
@ -0,0 +1,196 @@ |
||||
<?php |
||||
|
||||
namespace Chamilo\ThemeBundle\DependencyInjection; |
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder; |
||||
use Symfony\Component\Config\FileLocator; |
||||
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; |
||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
||||
use Symfony\Component\DependencyInjection\Loader; |
||||
|
||||
/** |
||||
* This is the class that loads and manages your bundle configuration |
||||
* |
||||
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html} |
||||
*/ |
||||
class ChamiloThemeExtension extends Extension implements PrependExtensionInterface |
||||
{ |
||||
/** |
||||
* {@inheritDoc} |
||||
*/ |
||||
public function load(array $configs, ContainerBuilder $container) |
||||
{ |
||||
$configuration = new Configuration(); |
||||
//$config = $this->processConfiguration($configuration, $configs); |
||||
|
||||
//$container->setParameter('avanzu_admin_theme.bower_bin', $config['bower_bin']); |
||||
|
||||
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
||||
$loader->load('services.xml'); |
||||
} |
||||
|
||||
/** |
||||
* Allow an extension to prepend the extension configurations. |
||||
* |
||||
* @param ContainerBuilder $container |
||||
*/ |
||||
public function prepend(ContainerBuilder $container) |
||||
{ |
||||
$bundles = $container->getParameter('kernel.bundles'); |
||||
|
||||
if (isset($bundles['TwigBundle'])) { |
||||
$container->prependExtensionConfig('twig', array( |
||||
'form' => array( |
||||
'resources' => array( |
||||
'ChamiloThemeBundle:Layout:form-theme.html.twig' |
||||
) |
||||
), |
||||
'globals' => array( |
||||
'admin_theme' => 'chamilo_admin_theme.theme_manager' |
||||
) |
||||
)); |
||||
} |
||||
|
||||
return; |
||||
|
||||
$jsAssets = '@ChamiloThemeBundle/Resources/'; |
||||
$lteJs = $jsAssets . 'public/vendor/adminlte/js/'; |
||||
$cssAssets = 'bundles/avanzuadmintheme/'; |
||||
$lteCss = $cssAssets . 'vendor/adminlte/css/'; |
||||
$lteFont = $cssAssets . 'vendor/adminlte/fonts/'; |
||||
|
||||
if (isset($bundles['AsseticBundle']) && 0) { |
||||
$container->prependExtensionConfig( |
||||
'assetic', |
||||
array( |
||||
'bundles' => array( |
||||
'ChamiloThemeBundle' |
||||
), |
||||
'assets' => array( |
||||
'common_js' => array( |
||||
'inputs' => array( |
||||
$jsAssets . 'public/vendor/jquery/dist/jquery.js', |
||||
$jsAssets . 'public/vendor/jquery-ui/jquery-ui.js', |
||||
$jsAssets . 'public/vendor/underscore/underscore.js', |
||||
$jsAssets . 'public/vendor/backbone/backbone.js', |
||||
$jsAssets . 'public/vendor/marionette/lib/backbone.marionette.js', |
||||
$jsAssets . 'public/vendor/bootstrap/dist/js/bootstrap.min.js', |
||||
$jsAssets . 'public/vendor/bootbox/bootbox.js', |
||||
$jsAssets . 'public/js/dialogs.js', |
||||
$jsAssets . 'public/js/namespace.js', |
||||
), |
||||
), |
||||
'tools_js' => array( |
||||
'inputs' => array( |
||||
'@common_js', |
||||
$jsAssets . 'public/vendor/momentjs/moment.js', |
||||
$jsAssets . 'public/vendor/holderjs/holder.js', |
||||
$jsAssets . 'public/vendor/spinjs/spin.js', |
||||
), |
||||
), |
||||
'admin_lte_js' => array( |
||||
'inputs' => array( |
||||
$lteJs . 'plugins/bootstrap-slider/bootstrap-slider.js', |
||||
$lteJs . 'plugins/datatables/jquery.dataTables.js', |
||||
$lteJs . 'plugins/datatables/dataTables.bootstrap.js', |
||||
$lteJs . 'plugins/slimScroll/jquery.slimscroll.js', |
||||
$jsAssets . 'public/js/adminLTE.js', |
||||
) |
||||
), |
||||
'admin_lte_css' => array( |
||||
'inputs' => array( |
||||
|
||||
// $lteCss . 'jQueryUI/jquery-ui-1.10.3.custom.css', |
||||
$cssAssets . 'vendor/bootstrap/dist/css/bootstrap.min.css', |
||||
$lteCss . 'bootstrap-slider/slider.css', |
||||
$lteCss . 'datatables/dataTables.bootstrap.css', |
||||
$cssAssets . 'vendor/fontawesome/css/font-awesome.min.css', |
||||
$cssAssets . 'vendor/ionicons/css/ionicons.min.css', |
||||
$lteCss . 'AdminLTE.css', |
||||
//$lteFont . 'fontawesome-webfont.eot', |
||||
// $lteFont . 'ionicons.eot', |
||||
) |
||||
), |
||||
'admin_lte_forms_js' => array( |
||||
'inputs' => array( |
||||
$lteJs . 'plugins/colorpicker/bootstrap-colorpicker.js', |
||||
$lteJs . 'plugins/daterangepicker/daterangepicker.js', |
||||
$lteJs . 'plugins/timepicker/bootstrap-timepicker.js', |
||||
$lteJs . 'plugins/input-mask/jquery.inputmask.js', |
||||
// $lteJs.'plugins/input-mask/*', |
||||
) |
||||
), |
||||
'admin_lte_forms_css' => array( |
||||
'inputs' => array( |
||||
$lteCss . 'colorpicker/bootstrap-colorpicker.css', |
||||
$lteCss . 'daterangepicker/daterangepicker-bs3.css', |
||||
$lteCss . 'timepicker/bootstrap-timepicker.css', |
||||
) |
||||
), |
||||
'admin_lte_wysiwyg' => array( |
||||
'inputs' => array( |
||||
$lteJs . 'plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.js', |
||||
) |
||||
), |
||||
'admin_lte_wysiwyg_css' => array( |
||||
'inputs' => array( |
||||
$lteCss . 'bootstrap-wysihtml5/bootstrap3-wysihtml5.css', |
||||
) |
||||
), |
||||
'admin_lte_morris' => array( |
||||
'inputs' => array( |
||||
$lteJs . 'plugins/morris/morris.js', |
||||
) |
||||
), |
||||
'admin_lte_morris_css' => array( |
||||
'inputs' => array( |
||||
$lteCss . 'morris/morris.css', |
||||
) |
||||
), |
||||
'admin_lte_flot' => array( |
||||
'inputs' => array( |
||||
$lteJs . 'plugins/flot/*', |
||||
) |
||||
), |
||||
'admin_lte_calendar' => array( |
||||
'inputs' => array( |
||||
$jsAssets . 'public/vendor/fullcalendar/dist/fullcalendar.min.js', |
||||
) |
||||
), |
||||
'admin_lte_calendar_css' => array( |
||||
'inputs' => array( |
||||
$lteCss . 'fullcalendar/fullcalendar.css', |
||||
) |
||||
), |
||||
'avatar_img' => array( |
||||
'inputs' => array( |
||||
'@ChamiloThemeBundle/Resources/public/img/avatar.png' |
||||
) |
||||
), |
||||
'admin_lte_all' => array( |
||||
'inputs' => array( |
||||
'@tools_js', |
||||
'@admin_lte_forms_js', |
||||
'@admin_lte_wysiwyg', |
||||
'@admin_lte_morris', |
||||
'@admin_lte_calendar', |
||||
'@admin_lte_js', |
||||
// '@admin_lte_flot', |
||||
) |
||||
), |
||||
'admin_lte_all_css' => array( |
||||
'inputs' => array( |
||||
'@admin_lte_calendar_css', |
||||
'@admin_lte_morris_css', |
||||
'@admin_lte_wysiwyg_css', |
||||
'@admin_lte_forms_css', |
||||
'@admin_lte_css' |
||||
) |
||||
), |
||||
) |
||||
) |
||||
); |
||||
|
||||
} |
||||
} |
||||
} |
@ -0,0 +1,23 @@ |
||||
<?php |
||||
|
||||
namespace Chamilo\ThemeBundle\DependencyInjection; |
||||
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
||||
use Symfony\Component\Config\Definition\ConfigurationInterface; |
||||
|
||||
/** |
||||
* This is the class that validates and merges configuration from your app/config files |
||||
* |
||||
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class} |
||||
*/ |
||||
class Configuration implements ConfigurationInterface |
||||
{ |
||||
/** |
||||
* {@inheritDoc} |
||||
*/ |
||||
public function getConfigTreeBuilder() |
||||
{ |
||||
$treeBuilder = new TreeBuilder(); |
||||
return $treeBuilder; |
||||
} |
||||
} |
@ -0,0 +1,69 @@ |
||||
<?php |
||||
/** |
||||
* MessageListEvent.php |
||||
* avanzu-admin |
||||
* Date: 23.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Event; |
||||
|
||||
|
||||
use Chamilo\ThemeBundle\Model\MessageInterface; |
||||
|
||||
/** |
||||
* The MessageListEvent should be used with the {@link ThemeEvents::THEME_MESSAGES} |
||||
* in order to collect all {@link MessageInterface} objects that should be rendered in the messages section. |
||||
* |
||||
*/ |
||||
class MessageListEvent extends ThemeEvent |
||||
{ |
||||
|
||||
/** |
||||
* Stores the list of messages |
||||
* @var array |
||||
*/ |
||||
protected $messages = array(); |
||||
|
||||
/** |
||||
* Stores the total amount |
||||
* @var int |
||||
*/ |
||||
protected $totalMessages = 0; |
||||
|
||||
/** |
||||
* Returns the message list |
||||
* |
||||
* @return array |
||||
*/ |
||||
public function getMessages() |
||||
{ |
||||
return $this->messages; |
||||
} |
||||
|
||||
/** |
||||
* Pushes the given message to the list of messages. |
||||
* |
||||
* @param MessageInterface $messageInterface |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function addMessage(MessageInterface $messageInterface) |
||||
{ |
||||
|
||||
$this->messages[] = $messageInterface; |
||||
|
||||
return $this; |
||||
|
||||
} |
||||
|
||||
/** |
||||
* Returns the message count |
||||
* |
||||
* @return int |
||||
*/ |
||||
public function getTotal() |
||||
{ |
||||
return $this->totalMessages == 0 ? sizeof($this->messages) : $this->totalMessages; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,66 @@ |
||||
<?php |
||||
/** |
||||
* NotificationListEvent.php |
||||
* avanzu-admin |
||||
* Date: 23.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Event; |
||||
|
||||
|
||||
use Chamilo\ThemeBundle\Model\NotificationInterface; |
||||
|
||||
/** |
||||
* Class NotificationListEvent |
||||
* |
||||
* @package Chamilo\ThemeBundle\Event |
||||
*/ |
||||
class NotificationListEvent extends ThemeEvent |
||||
{ |
||||
|
||||
/** |
||||
* @var array |
||||
*/ |
||||
protected $notifications = array(); |
||||
|
||||
protected $total = 0; |
||||
|
||||
/** |
||||
* @return array |
||||
*/ |
||||
public function getNotifications() |
||||
{ |
||||
return $this->notifications; |
||||
} |
||||
|
||||
/** |
||||
* @param NotificationInterface $notificationInterface |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function addNotification(NotificationInterface $notificationInterface) |
||||
{ |
||||
$this->notifications[] = $notificationInterface; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @param int $total |
||||
*/ |
||||
public function setTotal($total) |
||||
{ |
||||
$this->total = $total; |
||||
} |
||||
|
||||
/** |
||||
* @return int |
||||
*/ |
||||
public function getTotal() |
||||
{ |
||||
return $this->total == 0 ? sizeof($this->notifications) : $this->total; |
||||
} |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,42 @@ |
||||
<?php |
||||
/** |
||||
* ShowUserEvent.php |
||||
* avanzu-admin |
||||
* Date: 23.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Event; |
||||
|
||||
use Chamilo\ThemeBundle\Model\UserInterface; |
||||
|
||||
/** |
||||
* Class ShowUserEvent |
||||
* @package Chamilo\ThemeBundle\Event |
||||
*/ |
||||
class ShowUserEvent extends ThemeEvent |
||||
{ |
||||
/** |
||||
* @var UserInterface |
||||
*/ |
||||
protected $user; |
||||
|
||||
/** |
||||
* @param \Chamilo\ThemeBundle\Model\UserInterface $user |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setUser($user) |
||||
{ |
||||
$this->user = $user; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return \Chamilo\ThemeBundle\Model\UserInterface |
||||
*/ |
||||
public function getUser() |
||||
{ |
||||
return $this->user; |
||||
} |
||||
} |
@ -0,0 +1,84 @@ |
||||
<?php |
||||
/** |
||||
* SidebarMenuEvent.php |
||||
* avanzu-admin |
||||
* Date: 23.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Event; |
||||
|
||||
|
||||
use Chamilo\ThemeBundle\Model\MenuItemInterface; |
||||
use Symfony\Component\HttpFoundation\Request; |
||||
|
||||
/** |
||||
* Class SidebarMenuEvent |
||||
* |
||||
* @package Chamilo\ThemeBundle\Event |
||||
*/ |
||||
class SidebarMenuEvent extends ThemeEvent |
||||
{ |
||||
|
||||
/** |
||||
* @var array |
||||
*/ |
||||
protected $menuRootItems = array(); |
||||
|
||||
/** |
||||
* @var Request |
||||
*/ |
||||
protected $request; |
||||
|
||||
public function __construct($request = null) |
||||
{ |
||||
$this->request = $request; |
||||
} |
||||
|
||||
/** |
||||
* @return \Symfony\Component\HttpFoundation\Request |
||||
*/ |
||||
public function getRequest() |
||||
{ |
||||
return $this->request; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* @return array |
||||
*/ |
||||
public function getItems() |
||||
{ |
||||
return $this->menuRootItems; |
||||
} |
||||
|
||||
/** |
||||
* @param MenuItemInterface $item |
||||
*/ |
||||
public function addItem($item) |
||||
{ |
||||
$this->menuRootItems[$item->getIdentifier()] = $item; |
||||
} |
||||
|
||||
/** |
||||
* @param $id |
||||
* |
||||
* @return null |
||||
*/ |
||||
public function getRootItem($id) |
||||
{ |
||||
return isset($this->menuRootItems[$id]) ? $this->menuRootItems[$id] : null; |
||||
} |
||||
|
||||
/** |
||||
* @return MenuItemInterface|null |
||||
*/ |
||||
public function getActive() { |
||||
|
||||
foreach($this->getItems() as $item) { |
||||
/** @var $item MenuItemInterface */ |
||||
if($item->isActive()) return $item; |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,97 @@ |
||||
<?php |
||||
|
||||
namespace Chamilo\ThemeBundle\Event; |
||||
|
||||
use Chamilo\ThemeBundle\Model\MenuItemInterface; |
||||
use Knp\Menu\MenuItem; |
||||
use Symfony\Component\HttpFoundation\Request; |
||||
|
||||
/** |
||||
* Class SidebarMenuKnpEvent |
||||
* |
||||
* @package Chamilo\ThemeBundle\Event |
||||
*/ |
||||
class SidebarMenuKnpEvent extends ThemeEvent |
||||
{ |
||||
/** |
||||
* @var array |
||||
*/ |
||||
protected $menuRootItems = array(); |
||||
|
||||
protected $menu; |
||||
|
||||
/** |
||||
* @var Request |
||||
*/ |
||||
protected $request; |
||||
|
||||
public function __construct($request = null) |
||||
{ |
||||
$this->request = $request; |
||||
} |
||||
|
||||
/** |
||||
* @return \Symfony\Component\HttpFoundation\Request |
||||
*/ |
||||
public function getRequest() |
||||
{ |
||||
return $this->request; |
||||
} |
||||
|
||||
/** |
||||
* @return MenuItem |
||||
*/ |
||||
public function getMenu() |
||||
{ |
||||
return $this->menu; |
||||
} |
||||
|
||||
/** |
||||
* @param MenuItem $menu |
||||
*/ |
||||
public function setMenu(MenuItem $menu) |
||||
{ |
||||
$this->menu = $menu; |
||||
} |
||||
|
||||
/** |
||||
* @return array |
||||
*/ |
||||
public function getItems() |
||||
{ |
||||
return $this->menuRootItems; |
||||
} |
||||
|
||||
/** |
||||
* @param MenuItem $item |
||||
*/ |
||||
public function addItem(MenuItem $item) |
||||
{ |
||||
$this->menuRootItems[$item->getUri()] = $item; |
||||
} |
||||
|
||||
/** |
||||
* @param $id |
||||
* |
||||
* @return null |
||||
*/ |
||||
public function getRootItem($id) |
||||
{ |
||||
return isset($this->menuRootItems[$id]) ? $this->menuRootItems[$id] : null; |
||||
} |
||||
|
||||
/** |
||||
* @return MenuItemInterface|null |
||||
*/ |
||||
public function getActive() |
||||
{ |
||||
foreach ($this->getMenu() as $child) { |
||||
if ($child->isCurrent()) { |
||||
return $child; |
||||
} |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,59 @@ |
||||
<?php |
||||
/** |
||||
* TaskListEvent.php |
||||
* avanzu-admin |
||||
* Date: 23.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Event; |
||||
|
||||
|
||||
use Chamilo\ThemeBundle\Model\TaskInterface; |
||||
|
||||
class TaskListEvent extends ThemeEvent { |
||||
|
||||
protected $tasks = array(); |
||||
|
||||
protected $total = 0; |
||||
|
||||
/** |
||||
* @return array |
||||
*/ |
||||
public function getTasks() |
||||
{ |
||||
return $this->tasks; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* @param TaskInterface $taskInterface |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function addTask(TaskInterface $taskInterface){ |
||||
$this->tasks[] = $taskInterface; |
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @param int $total |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setTotal($total) |
||||
{ |
||||
$this->total = $total; |
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return int |
||||
*/ |
||||
public function getTotal() |
||||
{ |
||||
return $this->total == 0 ? sizeof($this->tasks) : $this->total; |
||||
} |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,18 @@ |
||||
<?php |
||||
/** |
||||
* ThemeEvent.php |
||||
* avanzu-admin |
||||
* Date: 23.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Event; |
||||
|
||||
use Symfony\Component\EventDispatcher\Event; |
||||
|
||||
/** |
||||
* Base event class to make theme related events easier to detect |
||||
* |
||||
*/ |
||||
class ThemeEvent extends Event { |
||||
|
||||
} |
@ -0,0 +1,61 @@ |
||||
<?php |
||||
/** |
||||
* ThemeEvents.php |
||||
* avanzu-admin |
||||
* Date: 23.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Event; |
||||
|
||||
|
||||
/** |
||||
* Holds all events used by the theme |
||||
* |
||||
*/ |
||||
class ThemeEvents |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* Used to receive notification data |
||||
*/ |
||||
const THEME_NOTIFICATIONS = 'theme.notifications'; |
||||
/** |
||||
* Used to receive message data |
||||
*/ |
||||
const THEME_MESSAGES = 'theme.messages'; |
||||
/** |
||||
* Used to receive task data |
||||
*/ |
||||
const THEME_TASKS = 'theme.tasks'; |
||||
/** |
||||
* |
||||
*/ |
||||
const THEME_NAVBAR_USER = 'theme.navbar_user'; |
||||
/** |
||||
* used to receive breadcrumb data |
||||
*/ |
||||
const THEME_BREADCRUMB = 'theme.breadcrumb'; |
||||
/** |
||||
* used to receive the current user for the sidebar |
||||
*/ |
||||
const THEME_SIDEBAR_USER = 'theme.sidebar_user'; |
||||
/** |
||||
* Used for searching |
||||
* @unused |
||||
*/ |
||||
const THEME_SIDEBAR_SEARCH = 'theme.sidebar_search'; |
||||
/** |
||||
* Used to receive the sidebar menu data |
||||
*/ |
||||
const THEME_SIDEBAR_SETUP_MENU = 'theme.sidebar_setup_menu'; |
||||
/** |
||||
* Used to receive the sidebar menu data |
||||
*/ |
||||
const THEME_SIDEBAR_SETUP_MENU_KNP = 'theme.sidebar_setup_menu_knp'; |
||||
/** |
||||
* |
||||
*/ |
||||
const THEME_SIDEBAR_ACTIVATE_MENU = 'theme.sidebar_activate_menu'; |
||||
|
||||
} |
@ -0,0 +1,62 @@ |
||||
<?php |
||||
/** |
||||
* ContextListener.php |
||||
* publisher |
||||
* Date: 23.05.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\EventListener; |
||||
|
||||
|
||||
use Symfony\Component\HttpKernel\Event\FilterControllerEvent; |
||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent; |
||||
use Symfony\Component\Security\Core\User\User; |
||||
use Symfony\Component\Security\Core\User\UserInterface; |
||||
|
||||
class ContextListener { |
||||
|
||||
protected $indicator = '^/admin'; |
||||
protected $container = null; |
||||
|
||||
function __construct($container) |
||||
{ |
||||
$this->container = $container; |
||||
} |
||||
|
||||
|
||||
public function onRequest(GetResponseEvent $event) |
||||
{ |
||||
$request = $event->getRequest(); |
||||
$uri = $request->getPathInfo(); |
||||
if(!preg_match('!'.$this->indicator.'!', $uri)) { |
||||
return; |
||||
} |
||||
|
||||
if(false == ($user = $this->getUser())){ |
||||
return; |
||||
} |
||||
|
||||
} |
||||
|
||||
public function getUser() |
||||
{ |
||||
if (!$this->container->has('security.context')) { |
||||
return false; |
||||
} |
||||
|
||||
if (null === $token = $this->container->get('security.context')->getToken()) { |
||||
return false; |
||||
} |
||||
|
||||
if (!is_object($user = $token->getUser())) { |
||||
return false; |
||||
} |
||||
|
||||
return $user; |
||||
} |
||||
|
||||
public function onController(FilterControllerEvent $event) |
||||
{ |
||||
|
||||
} |
||||
} |
@ -0,0 +1,31 @@ |
||||
<?php |
||||
/** |
||||
* NavbarMessageListDemoListener.php |
||||
* avanzu-admin |
||||
* Date: 23.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\EventListener; |
||||
|
||||
|
||||
use Chamilo\ThemeBundle\Event\MessageListEvent; |
||||
use Chamilo\ThemeBundle\Model\MessageModel; |
||||
use Chamilo\ThemeBundle\Model\UserModel; |
||||
|
||||
class NavbarMessageListDemoListener { |
||||
|
||||
public function onListMessages(MessageListEvent $event) { |
||||
|
||||
foreach($this->getMessages() as $msg) { |
||||
$event->addMessage($msg); |
||||
} |
||||
} |
||||
|
||||
protected function getMessages() { |
||||
return array( |
||||
new MessageModel(new UserModel('Karl kettenkit'),'Dude! do something!', new \DateTime('-3 days')), |
||||
new MessageModel(new UserModel('Jack Trockendoc'),'This is some subject', new \DateTime('-10 month')), |
||||
); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,32 @@ |
||||
<?php |
||||
/** |
||||
* NavbarNotificationListDemoListener.php |
||||
* avanzu-admin |
||||
* Date: 23.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\EventListener; |
||||
|
||||
|
||||
use Chamilo\ThemeBundle\Event\NotificationListEvent; |
||||
use Chamilo\ThemeBundle\Model\NotificationModel; |
||||
|
||||
class NavbarNotificationListDemoListener { |
||||
|
||||
|
||||
public function onListNotifications(NotificationListEvent $event) { |
||||
|
||||
foreach($this->getNotifications() as $notify){ |
||||
$event->addNotification($notify); |
||||
} |
||||
|
||||
} |
||||
|
||||
protected function getNotifications() { |
||||
return array( |
||||
new NotificationModel('some notification'), |
||||
new NotificationModel('some more notices', 'success'), |
||||
); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,24 @@ |
||||
<?php |
||||
/** |
||||
* NavbarShowUserListener.php |
||||
* avanzu-admin |
||||
* Date: 23.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\EventListener; |
||||
|
||||
|
||||
use Chamilo\ThemeBundle\Event\ShowUserEvent; |
||||
use Chamilo\ThemeBundle\Model\UserModel; |
||||
|
||||
class NavbarShowUserDemoListener { |
||||
|
||||
public function onShowUser(ShowUserEvent $event) { |
||||
|
||||
$user = new UserModel(); |
||||
$user->setAvatar('')->setIsOnline(true)->setMemberSince(new \DateTime())->setUsername('Demo User'); |
||||
|
||||
$event->setUser($user); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,36 @@ |
||||
<?php |
||||
/** |
||||
* NavbarTaskListDemoListener.php |
||||
* avanzu-admin |
||||
* Date: 23.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\EventListener; |
||||
|
||||
|
||||
use Chamilo\ThemeBundle\Event\TaskListEvent; |
||||
use Chamilo\ThemeBundle\Model\TaskModel; |
||||
|
||||
class NavbarTaskListDemoListener |
||||
{ |
||||
|
||||
public function onListTasks(TaskListEvent $event) |
||||
{ |
||||
|
||||
foreach($this->getTasks() as $task) { |
||||
$event->addTask($task); |
||||
} |
||||
|
||||
} |
||||
|
||||
protected function getTasks() |
||||
{ |
||||
return array( |
||||
new TaskModel('make stuff', 30, TaskModel::COLOR_GREEN), |
||||
new TaskModel('make more stuff', 60), |
||||
new TaskModel('some more tasks to do', 10, TaskModel::COLOR_RED) |
||||
); |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,51 @@ |
||||
<?php |
||||
/** |
||||
* SetupThemeListener.php |
||||
* publisher |
||||
* Date: 01.05.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\EventListener; |
||||
|
||||
|
||||
use Chamilo\ThemeBundle\Theme\ThemeManager; |
||||
use Symfony\Component\HttpKernel\Event\FilterControllerEvent; |
||||
|
||||
class SetupThemeListener { |
||||
|
||||
/** |
||||
* @var ThemeManager |
||||
*/ |
||||
protected $manager; |
||||
|
||||
protected $cssBase; |
||||
|
||||
protected $lteAdmin; |
||||
|
||||
function __construct($manager, $cssBase = null, $lteAdmin = null) |
||||
{ |
||||
$this->cssBase = $cssBase?:'bundles/avanzuadmintheme/'; |
||||
$this->lteAdmin = $lteAdmin?:'vendor/AdminLTE/css/'; |
||||
$this->manager = $manager; |
||||
} |
||||
|
||||
|
||||
public function onKernelController(FilterControllerEvent $event) { |
||||
|
||||
$css = rtrim($this->cssBase, '/').'/'.trim($this->lteAdmin, '/'); |
||||
$mng = $this->manager; |
||||
|
||||
$mng->registerStyle('jquery-ui', $css.'/jQueryUI/jquery-ui-1.10.3.custom.css'); |
||||
$mng->registerStyle('bootstrap', $css.'/bootstrap.css', array('jquery-ui')); |
||||
$mng->registerStyle('bootstrap-slider', $css.'/bootstrap-slider/slider.css', array('bootstrap')); |
||||
$mng->registerStyle('datatables', $css.'/datatables/dataTables.bootstrap.css', array('bootstrap')); |
||||
$mng->registerStyle('fontawesome', $css.'/font-awesome.css'); |
||||
$mng->registerStyle('ionicons', $css.'/ionicons.css'); |
||||
$mng->registerStyle('admin-lte', $css.'/AdminLTE.css', array('bootstrap-slider', 'fontawesome', 'ionicons','datatables')); |
||||
$mng->registerStyle('bs-colorpicker', $css.'/colorpicker/bootstrap-colorpicker.css', array('admin-lte')); |
||||
$mng->registerStyle('daterangepicker', $css.'/daterangepicker/daterangepicker-bs3.css', array('admin-lte')); |
||||
$mng->registerStyle('timepicker', $css.'/timepicker/bootstrap-timepicker.css', array('admin-lte')); |
||||
$mng->registerStyle('wysiwyg', $css.'/bootstrap-wysihtml5/bootstrap3-wysihtml5.css', array('admin-lte')); |
||||
|
||||
} |
||||
} |
@ -0,0 +1,63 @@ |
||||
<?php |
||||
/** |
||||
* SidebarSetupMenuDemoListener.php |
||||
* avanzu-admin |
||||
* Date: 23.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\EventListener; |
||||
|
||||
|
||||
use Chamilo\ThemeBundle\Event\SidebarMenuEvent; |
||||
use Chamilo\ThemeBundle\Model\MenuItemModel; |
||||
use Symfony\Component\HttpFoundation\Request; |
||||
|
||||
class SidebarSetupMenuDemoListener |
||||
{ |
||||
|
||||
public function onSetupMenu(SidebarMenuEvent $event) |
||||
{ |
||||
$request = $event->getRequest(); |
||||
|
||||
foreach ($this->getMenu($request) as $item) { |
||||
$event->addItem($item); |
||||
} |
||||
|
||||
} |
||||
|
||||
|
||||
protected function getMenu(Request $request) |
||||
{ |
||||
$earg = array(); |
||||
$rootItems = array( |
||||
$dash = new MenuItemModel('dashboard', 'Dashboard', 'avanzu_admin_dash_demo', $earg, 'fa fa-dashboard'), |
||||
$form = new MenuItemModel('forms', 'Forms', 'avanzu_admin_form_demo', $earg, 'fa fa-edit'), |
||||
$widgets = new MenuItemModel('widgets', 'Widgets', 'avanzu_admin_demo', $earg, 'fa fa-th', 'new'), |
||||
$ui = new MenuItemModel('ui-elements', 'UI Elements', '', $earg, 'fa fa-laptop') |
||||
); |
||||
|
||||
$ui->addChild(new MenuItemModel('ui-elements-general', 'General', 'avanzu_admin_ui_gen_demo', $earg)) |
||||
->addChild($icons = new MenuItemModel('ui-elements-icons', 'Icons', 'avanzu_admin_ui_icon_demo', $earg)); |
||||
|
||||
return $this->activateByRoute($request->get('_route'), $rootItems); |
||||
|
||||
} |
||||
|
||||
protected function activateByRoute($route, $items) { |
||||
|
||||
foreach($items as $item) { /** @var $item MenuItemModel */ |
||||
if($item->hasChildren()) { |
||||
$this->activateByRoute($route, $item->getChildren()); |
||||
} |
||||
else { |
||||
if($item->getRoute() == $route) { |
||||
$item->setIsActive(true); |
||||
} |
||||
} |
||||
} |
||||
|
||||
return $items; |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,60 @@ |
||||
<?php |
||||
/** |
||||
* FormDemoModelType.php |
||||
* avanzu-admin |
||||
* Date: 23.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Form; |
||||
|
||||
use Symfony\Component\Form\AbstractType; |
||||
use Symfony\Component\Form\FormBuilderInterface; |
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
||||
|
||||
class FormDemoModelType extends AbstractType{ |
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options) |
||||
{ |
||||
$options = array( |
||||
'opt1' => 'This is option 1', |
||||
'opt2' => 'This is option 2', |
||||
'opt3' => 'This is option 3', |
||||
); |
||||
|
||||
$choices = array( |
||||
'choice1' => 'This is choice 1', |
||||
'choice2' => 'This is choice 2', |
||||
'choice3' => 'This is choice 3', |
||||
); |
||||
|
||||
$builder->add('name', 'text') |
||||
->add('gender', 'choice', array('choices' => array('m' => 'male', 'f' => 'female'))) |
||||
->add('someOption', 'choice', array('choices' => $options, 'expanded' => true)) |
||||
->add('someChoices', 'choice', array('choices' => $choices, 'expanded' => true, 'multiple' => true)) |
||||
->add('username') |
||||
->add('email') |
||||
->add('termsAccepted','checkbox') |
||||
->add('message', 'textarea') |
||||
->add('price') |
||||
->add('date', 'date', array('widget' => 'single_text')) |
||||
->add('time', 'time', array('widget' => 'single_text')) |
||||
; |
||||
} |
||||
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver) |
||||
{ |
||||
$resolver->setDefaults(array( |
||||
'data_class' => 'Chamilo\ThemeBundle\Model\FormDemoModel', |
||||
)); |
||||
} |
||||
|
||||
/** |
||||
* Returns the name of this type. |
||||
* |
||||
* @return string The name of this type |
||||
*/ |
||||
public function getName() |
||||
{ |
||||
return 'form_demo'; |
||||
} |
||||
} |
@ -0,0 +1,17 @@ |
||||
<?php |
||||
/** |
||||
* WidgetHelper.php |
||||
* avanzu-admin |
||||
* Date: 16.03.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Helper; |
||||
|
||||
|
||||
class WidgetHelper extends \Twig_Extension { |
||||
|
||||
public function getName() |
||||
{ |
||||
return 'widget'; |
||||
} |
||||
} |
@ -0,0 +1,104 @@ |
||||
<?php |
||||
/** |
||||
* MenuItemInterface.php |
||||
* avanzu-admin |
||||
* Date: 23.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Model; |
||||
|
||||
|
||||
/** |
||||
* Interface MenuItemInterface |
||||
* |
||||
* @package Chamilo\ThemeBundle\Model |
||||
*/ |
||||
interface MenuItemInterface { |
||||
/** |
||||
* @return mixed |
||||
*/ |
||||
public function getIdentifier(); |
||||
|
||||
/** |
||||
* @return mixed |
||||
*/ |
||||
public function getLabel(); |
||||
|
||||
/** |
||||
* @return mixed |
||||
*/ |
||||
public function getRoute(); |
||||
|
||||
/** |
||||
* @return mixed |
||||
*/ |
||||
public function isActive(); |
||||
|
||||
/** |
||||
* @param $isActive |
||||
* |
||||
* @return mixed |
||||
*/ |
||||
public function setIsActive($isActive); |
||||
|
||||
/** |
||||
* @return mixed |
||||
*/ |
||||
public function hasChildren(); |
||||
|
||||
/** |
||||
* @return mixed |
||||
*/ |
||||
public function getChildren(); |
||||
|
||||
/** |
||||
* @param MenuItemInterface $child |
||||
* |
||||
* @return mixed |
||||
*/ |
||||
public function addChild(MenuItemInterface $child); |
||||
|
||||
/** |
||||
* @param MenuItemInterface $child |
||||
* |
||||
* @return mixed |
||||
*/ |
||||
public function removeChild(MenuItemInterface $child); |
||||
|
||||
/** |
||||
* @return mixed |
||||
*/ |
||||
public function getIcon(); |
||||
|
||||
/** |
||||
* @return mixed |
||||
*/ |
||||
public function getBadge(); |
||||
|
||||
/** |
||||
* @return mixed |
||||
*/ |
||||
public function getBadgeColor(); |
||||
|
||||
/** |
||||
* @return mixed |
||||
*/ |
||||
public function getParent(); |
||||
|
||||
/** |
||||
* @return mixed |
||||
*/ |
||||
public function hasParent(); |
||||
|
||||
/** |
||||
* @param MenuItemInterface $parent |
||||
* |
||||
* @return mixed |
||||
*/ |
||||
public function setParent(MenuItemInterface $parent = null); |
||||
|
||||
/** |
||||
* @return MenuItemInterface|null |
||||
*/ |
||||
public function getActiveChild(); |
||||
} |
@ -0,0 +1,345 @@ |
||||
<?php |
||||
/** |
||||
* MenuItemModel.php |
||||
* avanzu-admin |
||||
* Date: 23.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Model; |
||||
|
||||
/** |
||||
* Class MenuItemModel |
||||
* |
||||
* @package Chamilo\ThemeBundle\Model |
||||
*/ |
||||
class MenuItemModel implements MenuItemInterface |
||||
{ |
||||
|
||||
/** |
||||
* @var mixed |
||||
*/ |
||||
protected $identifier; |
||||
|
||||
/** |
||||
* @var string |
||||
*/ |
||||
protected $label; |
||||
|
||||
/** |
||||
* @var string |
||||
*/ |
||||
protected $route; |
||||
|
||||
/** |
||||
* @var array |
||||
*/ |
||||
protected $routeArgs = array(); |
||||
/** |
||||
* @var bool |
||||
*/ |
||||
protected $isActive = false; |
||||
/** |
||||
* @var array |
||||
*/ |
||||
protected $children = array(); |
||||
|
||||
/** |
||||
* @var mixed |
||||
*/ |
||||
protected $icon = false; |
||||
|
||||
/** |
||||
* @var mixed |
||||
*/ |
||||
protected $badge = false; |
||||
|
||||
protected $badgeColor = 'green'; |
||||
|
||||
/** |
||||
* @var MenuItemInterface |
||||
*/ |
||||
protected $parent = null; |
||||
|
||||
function __construct( |
||||
$id, |
||||
$label, |
||||
$route, |
||||
$routeArgs = array(), |
||||
$icon = false, |
||||
$badge = false, |
||||
$badgeColor = 'green' |
||||
) { |
||||
$this->badge = $badge; |
||||
$this->icon = $icon; |
||||
$this->identifier = $id; |
||||
$this->label = $label; |
||||
$this->route = $route; |
||||
$this->routeArgs = $routeArgs; |
||||
$this->badgeColor = $badgeColor; |
||||
} |
||||
|
||||
/** |
||||
* @return mixed |
||||
*/ |
||||
public function getBadge() |
||||
{ |
||||
return $this->badge; |
||||
} |
||||
|
||||
/** |
||||
* @param mixed $badge |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setBadge($badge) |
||||
{ |
||||
$this->badge = $badge; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return array |
||||
*/ |
||||
public function getChildren() |
||||
{ |
||||
return $this->children; |
||||
} |
||||
|
||||
/** |
||||
* @param array $children |
||||
*/ |
||||
public function setChildren($children) |
||||
{ |
||||
$this->children = $children; |
||||
} |
||||
|
||||
/** |
||||
* @return mixed |
||||
*/ |
||||
public function getIcon() |
||||
{ |
||||
return $this->icon; |
||||
} |
||||
|
||||
/** |
||||
* @param mixed $icon |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setIcon($icon) |
||||
{ |
||||
$this->icon = $icon; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return mixed |
||||
*/ |
||||
public function getIdentifier() |
||||
{ |
||||
return $this->identifier; |
||||
} |
||||
|
||||
/** |
||||
* @param mixed $identifier |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setIdentifier($identifier) |
||||
{ |
||||
$this->identifier = $identifier; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return boolean |
||||
*/ |
||||
public function getIsActive() |
||||
{ |
||||
return $this->isActive; |
||||
} |
||||
|
||||
/** |
||||
* @param boolean $isActive |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setIsActive($isActive) |
||||
{ |
||||
if ($this->hasParent()) { |
||||
$this->getParent()->setIsActive($isActive); |
||||
} |
||||
|
||||
$this->isActive = $isActive; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return bool |
||||
*/ |
||||
public function hasParent() |
||||
{ |
||||
return ($this->parent instanceof MenuItemInterface); |
||||
} |
||||
|
||||
/** |
||||
* @return \Chamilo\ThemeBundle\Model\MenuItemInterface |
||||
*/ |
||||
public function getParent() |
||||
{ |
||||
return $this->parent; |
||||
} |
||||
|
||||
/** |
||||
* @param \Chamilo\ThemeBundle\Model\MenuItemInterface $parent |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setParent(MenuItemInterface $parent = null) |
||||
{ |
||||
$this->parent = $parent; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return string |
||||
*/ |
||||
public function getLabel() |
||||
{ |
||||
return $this->label; |
||||
} |
||||
|
||||
/** |
||||
* @param string $label |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setLabel($label) |
||||
{ |
||||
$this->label = $label; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return string |
||||
*/ |
||||
public function getRoute() |
||||
{ |
||||
return $this->route; |
||||
} |
||||
|
||||
/** |
||||
* @param string $route |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setRoute($route) |
||||
{ |
||||
$this->route = $route; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return array |
||||
*/ |
||||
public function getRouteArgs() |
||||
{ |
||||
return $this->routeArgs; |
||||
} |
||||
|
||||
/** |
||||
* @param array $routeArgs |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setRouteArgs($routeArgs) |
||||
{ |
||||
$this->routeArgs = $routeArgs; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return bool |
||||
*/ |
||||
public function hasChildren() |
||||
{ |
||||
return (sizeof($this->children) > 0); |
||||
} |
||||
|
||||
/** |
||||
* @param MenuItemInterface $child |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function addChild(MenuItemInterface $child) |
||||
{ |
||||
$child->setParent($this); |
||||
$this->children[] = $child; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @param MenuItemInterface $child |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function removeChild(MenuItemInterface $child) |
||||
{ |
||||
if (false !== ($key = array_search($child, $this->children))) { |
||||
unset ($this->children[$key]); |
||||
} |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return string |
||||
*/ |
||||
public function getBadgeColor() |
||||
{ |
||||
return $this->badgeColor; |
||||
} |
||||
|
||||
/** |
||||
* @param string $badgeColor |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setBadgeColor($badgeColor) |
||||
{ |
||||
$this->badgeColor = $badgeColor; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return MenuItemInterface|null |
||||
*/ |
||||
public function getActiveChild() |
||||
{ |
||||
foreach ($this->children as $child) { |
||||
if ($child->isActive()) { |
||||
return $child; |
||||
} |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
/** |
||||
* @return bool |
||||
*/ |
||||
public function isActive() |
||||
{ |
||||
return $this->isActive; |
||||
} |
||||
} |
@ -0,0 +1,42 @@ |
||||
<?php |
||||
/** |
||||
* MessageInterface.php |
||||
* avanzu-admin |
||||
* Date: 23.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Model; |
||||
|
||||
|
||||
/** |
||||
* Representation of a displayable message in the theme's messages section |
||||
* |
||||
*/ |
||||
interface MessageInterface { |
||||
/** |
||||
* Returns the sender |
||||
* |
||||
* @return mixed |
||||
*/ |
||||
public function getFrom(); |
||||
|
||||
/** |
||||
* Returns the sentAt date |
||||
* @return \DateTime |
||||
*/ |
||||
public function getSentAt(); |
||||
|
||||
/** |
||||
* Returns the subject |
||||
* |
||||
* @return string |
||||
*/ |
||||
public function getSubject(); |
||||
|
||||
/** |
||||
* Returns the unique identifier of this message |
||||
* |
||||
* @return mixed |
||||
*/ |
||||
public function getIdentifier(); |
||||
} |
@ -0,0 +1,164 @@ |
||||
<?php |
||||
/** |
||||
* MessageModel.php |
||||
* avanzu-admin |
||||
* Date: 23.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Model; |
||||
|
||||
/** |
||||
* Simple implementation of the MessageInterface |
||||
* |
||||
*/ |
||||
class MessageModel implements MessageInterface |
||||
{ |
||||
|
||||
/** |
||||
* Holds the sender |
||||
* |
||||
* @var UserInterface |
||||
*/ |
||||
protected $from; |
||||
|
||||
/** |
||||
* holds the Recipient |
||||
* |
||||
* @var UserInterface |
||||
*/ |
||||
protected $to; |
||||
|
||||
/** |
||||
* holds the date sent |
||||
* @var \DateTime |
||||
*/ |
||||
protected $sentAt; |
||||
|
||||
/** |
||||
* holds the subject |
||||
* |
||||
* @var string |
||||
*/ |
||||
protected $subject; |
||||
|
||||
/** |
||||
* Creates a new MessageModel object with the given values. |
||||
* |
||||
* SentAt will be set to the current DateTime when null is given. |
||||
* |
||||
* @param UserInterface $from |
||||
* @param string $subject |
||||
* @param null $sentAt |
||||
* @param UserInterface $to |
||||
*/ |
||||
function __construct(UserInterface $from = null, $subject= '', $sentAt = null, UserInterface $to = null) |
||||
{ |
||||
$this->to = $to; |
||||
$this->subject = $subject; |
||||
$this->sentAt = $sentAt ? : new \DateTime(); |
||||
$this->from = $from; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Set the sender |
||||
* |
||||
* @param \Chamilo\ThemeBundle\Model\UserInterface $from |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setFrom(UserInterface $from) |
||||
{ |
||||
$this->from = $from; |
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* Get the Sender |
||||
* |
||||
* @return \Chamilo\ThemeBundle\Model\UserInterface |
||||
*/ |
||||
public function getFrom() |
||||
{ |
||||
return $this->from; |
||||
} |
||||
|
||||
/** |
||||
* Set the date sent |
||||
* |
||||
* @param \DateTime $sentAt |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setSentAt(\DateTime $sentAt) |
||||
{ |
||||
$this->sentAt = $sentAt; |
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* Get the date sent |
||||
* |
||||
* @return \DateTime |
||||
*/ |
||||
public function getSentAt() |
||||
{ |
||||
return $this->sentAt; |
||||
} |
||||
|
||||
/** |
||||
* Set the subject |
||||
* |
||||
* @param string $subject |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setSubject($subject) |
||||
{ |
||||
$this->subject = $subject; |
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* Get the subject |
||||
* |
||||
* @return string |
||||
*/ |
||||
public function getSubject() |
||||
{ |
||||
return $this->subject; |
||||
} |
||||
|
||||
/** |
||||
* Set the recipient |
||||
* |
||||
* @param \Chamilo\ThemeBundle\Model\UserInterface $to |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setTo(UserInterface $to) |
||||
{ |
||||
$this->to = $to; |
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* Get the recipient |
||||
* |
||||
* @return \Chamilo\ThemeBundle\Model\UserInterface |
||||
*/ |
||||
public function getTo() |
||||
{ |
||||
return $this->to; |
||||
} |
||||
|
||||
/** |
||||
* Get the identifier |
||||
* |
||||
* @return string |
||||
*/ |
||||
public function getIdentifier() { |
||||
return $this->getSubject(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,16 @@ |
||||
<?php |
||||
/** |
||||
* NotificationInterface.php |
||||
* avanzu-admin |
||||
* Date: 23.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Model; |
||||
|
||||
|
||||
interface NotificationInterface { |
||||
public function getMessage(); |
||||
public function getType(); |
||||
public function getIcon(); |
||||
public function getIdentifier(); |
||||
} |
@ -0,0 +1,93 @@ |
||||
<?php |
||||
/** |
||||
* NotificationModel.php |
||||
* avanzu-admin |
||||
* Date: 23.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Model; |
||||
|
||||
|
||||
class NotificationModel implements NotificationInterface |
||||
{ |
||||
|
||||
|
||||
protected $type; |
||||
|
||||
protected $message; |
||||
|
||||
protected $icon; |
||||
|
||||
function __construct($message = null, $type = 'info', $icon = 'fa fa-warning') |
||||
{ |
||||
$this->message = $message; |
||||
$this->type = $type; |
||||
$this->icon = $icon; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* @param mixed $message |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setMessage($message) |
||||
{ |
||||
$this->message = $message; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return mixed |
||||
*/ |
||||
public function getMessage() |
||||
{ |
||||
return $this->message; |
||||
} |
||||
|
||||
/** |
||||
* @param mixed $type |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setType($type) |
||||
{ |
||||
$this->type = $type; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return mixed |
||||
*/ |
||||
public function getType() |
||||
{ |
||||
return $this->type; |
||||
} |
||||
|
||||
/** |
||||
* @param string $icon |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setIcon($icon) |
||||
{ |
||||
$this->icon = $icon; |
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return string |
||||
*/ |
||||
public function getIcon() |
||||
{ |
||||
return $this->icon; |
||||
} |
||||
|
||||
public function getIdentifier() |
||||
{ |
||||
return $this->message; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,17 @@ |
||||
<?php |
||||
/** |
||||
* TaskInterface.php |
||||
* avanzu-admin |
||||
* Date: 23.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Model; |
||||
|
||||
|
||||
interface TaskInterface { |
||||
|
||||
public function getColor(); |
||||
public function getProgress(); |
||||
public function getTitle(); |
||||
public function getIdentifier(); |
||||
} |
@ -0,0 +1,127 @@ |
||||
<?php |
||||
/** |
||||
* TaskModel.php |
||||
* avanzu-admin |
||||
* Date: 23.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Model; |
||||
|
||||
|
||||
/** |
||||
* Class TaskModel |
||||
* |
||||
* @package Chamilo\ThemeBundle\Model |
||||
*/ |
||||
class TaskModel implements TaskInterface |
||||
{ |
||||
|
||||
/** |
||||
* |
||||
*/ |
||||
const COLOR_AQUA = 'aqua'; |
||||
/** |
||||
* |
||||
*/ |
||||
const COLOR_GREEN = 'green'; |
||||
/** |
||||
* |
||||
*/ |
||||
const COLOR_RED = 'red'; |
||||
/** |
||||
* |
||||
*/ |
||||
const COLOR_YELLOW = 'yellow'; |
||||
|
||||
|
||||
/** |
||||
* @var int |
||||
*/ |
||||
protected $progress; |
||||
|
||||
/** |
||||
* @var string |
||||
*/ |
||||
protected $color = TaskModel::COLOR_AQUA; |
||||
|
||||
/** |
||||
* @var null |
||||
*/ |
||||
protected $title; |
||||
|
||||
/** |
||||
* @param null $title |
||||
* @param int $progress |
||||
* @param string $color |
||||
*/ |
||||
function __construct($title = null, $progress = 0, $color = TaskModel::COLOR_AQUA) |
||||
{ |
||||
$this->color = $color; |
||||
$this->progress = $progress; |
||||
$this->title = $title; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* @param string $color |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setColor($color) |
||||
{ |
||||
$this->color = $color; |
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return string |
||||
*/ |
||||
public function getColor() |
||||
{ |
||||
return $this->color; |
||||
} |
||||
|
||||
/** |
||||
* @param mixed $progress |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setProgress($progress) |
||||
{ |
||||
$this->progress = $progress; |
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return mixed |
||||
*/ |
||||
public function getProgress() |
||||
{ |
||||
return $this->progress; |
||||
} |
||||
|
||||
/** |
||||
* @param mixed $title |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setTitle($title) |
||||
{ |
||||
$this->title = $title; |
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return mixed |
||||
*/ |
||||
public function getTitle() |
||||
{ |
||||
return $this->title; |
||||
} |
||||
|
||||
public function getIdentifier() { |
||||
return $this->title; |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,17 @@ |
||||
<?php |
||||
/** |
||||
* UserInterface.php |
||||
* avanzu-admin |
||||
* Date: 23.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Model; |
||||
|
||||
|
||||
interface UserInterface { |
||||
public function getAvatar(); |
||||
public function getUsername(); |
||||
public function getMemberSince(); |
||||
public function isOnline(); |
||||
public function getIdentifier(); |
||||
} |
@ -0,0 +1,130 @@ |
||||
<?php |
||||
/** |
||||
* UserModel.php |
||||
* avanzu-admin |
||||
* Date: 23.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Model; |
||||
|
||||
|
||||
class UserModel implements UserInterface { |
||||
|
||||
/** |
||||
* @var string |
||||
*/ |
||||
protected $avatar; |
||||
|
||||
/** |
||||
* @var string |
||||
*/ |
||||
protected $username; |
||||
|
||||
/** |
||||
* @var \DateTime |
||||
*/ |
||||
protected $memberSince; |
||||
|
||||
/** |
||||
* @var bool |
||||
*/ |
||||
protected $isOnline = false; |
||||
|
||||
function __construct($username='', $avatar = '', $memberSince = null, $isOnline = true) |
||||
{ |
||||
$this->avatar = $avatar; |
||||
$this->isOnline = $isOnline; |
||||
$this->memberSince = $memberSince ?:new \DateTime(); |
||||
$this->username = $username; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* @param string $avatar |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setAvatar($avatar) |
||||
{ |
||||
$this->avatar = $avatar; |
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return string |
||||
*/ |
||||
public function getAvatar() |
||||
{ |
||||
return $this->avatar; |
||||
} |
||||
|
||||
/** |
||||
* @param boolean $isOnline |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setIsOnline($isOnline) |
||||
{ |
||||
$this->isOnline = $isOnline; |
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return boolean |
||||
*/ |
||||
public function getIsOnline() |
||||
{ |
||||
return $this->isOnline; |
||||
} |
||||
|
||||
/** |
||||
* @param \DateTime $memberSince |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setMemberSince(\DateTime $memberSince) |
||||
{ |
||||
$this->memberSince = $memberSince; |
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return \DateTime |
||||
*/ |
||||
public function getMemberSince() |
||||
{ |
||||
return $this->memberSince; |
||||
} |
||||
|
||||
/** |
||||
* @param string $username |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function setUsername($username) |
||||
{ |
||||
$this->username = $username; |
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return string |
||||
*/ |
||||
public function getUsername() |
||||
{ |
||||
return $this->username; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* @return bool |
||||
*/ |
||||
public function isOnline() |
||||
{ |
||||
return $this->getIsOnline(); |
||||
} |
||||
|
||||
public function getIdentifier() { |
||||
return str_replace(' ', '-', $this->getUsername()); |
||||
} |
||||
} |
@ -0,0 +1,15 @@ |
||||
ThemeBundle |
||||
================ |
||||
Based in AvanzuAdminThemeBundle |
||||
|
||||
Admin Theme based on the AdminLTE Template for easy integration into symfony. |
||||
This bundle integrates several commonly used javascripts and the awesome [AdminLTE Template](https://github.com/almasaeed2010/AdminLTE). |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,5 @@ |
||||
login: |
||||
path: /login |
||||
defaults: { _controller: ChamiloThemeBundle:Security:login } |
||||
login_check: |
||||
path: /login_check |
@ -0,0 +1,51 @@ |
||||
<?xml version="1.0" ?> |
||||
|
||||
<container xmlns="http://symfony.com/schema/dic/services" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> |
||||
<parameters> |
||||
<parameter key="chamilo_admin_theme.navbar_user_listener.class">Chamilo\ThemeBundle\EventListener\NavbarShowUserDemoListener</parameter> |
||||
<parameter key="chamilo_admin_theme.navbar_task_listener.class">Chamilo\ThemeBundle\EventListener\NavbarTaskListDemoListener</parameter> |
||||
<parameter key="chamilo_admin_theme.navbar_notify_listener.class">Chamilo\ThemeBundle\EventListener\NavbarNotificationListDemoListener</parameter> |
||||
<parameter key="chamilo_admin_theme.navbar_msg_listener.class">Chamilo\ThemeBundle\EventListener\NavbarMessageListDemoListener</parameter> |
||||
<parameter key="chamilo_admin_theme.setup_menu_listener.class">Chamilo\ThemeBundle\EventListener\SidebarSetupMenuDemoListener</parameter> |
||||
<parameter key="chamilo_admin_theme.exception_controller.class">Chamilo\ThemeBundle\Controller\ExceptionController</parameter> |
||||
<parameter key="twig.controller.exception.class">Chamilo\ThemeBundle\Controller\ExceptionController</parameter> |
||||
<parameter key="chamilo_admin_theme.widget_extension.class">Chamilo\ThemeBundle\Twig\WidgetExtension</parameter> |
||||
<parameter key="chamilo_admin_theme.theme_manager.class">Chamilo\ThemeBundle\Theme\ThemeManager</parameter> |
||||
<parameter key="chamilo_admin_theme.setup_theme_listener.class">Chamilo\ThemeBundle\EventListener\SetupThemeListener</parameter> |
||||
<parameter key="chamilo_admin_theme.dependency_resolver.class" /> |
||||
<parameter key="chamilo_admin_theme.css_base" /> |
||||
<parameter key="chamilo_admin_theme.lte_admin" /> |
||||
|
||||
</parameters> |
||||
|
||||
<services> |
||||
<service id="chamilo_admin_theme.exception_controller" class="%chamilo_admin_theme.exception_controller.class%"> |
||||
<argument type="service" id="twig"/> |
||||
<argument>%kernel.debug%</argument> |
||||
</service> |
||||
|
||||
<service id="chamilo_admin_theme.widget_extension.class" class="%chamilo_admin_theme.widget_extension.class%"> |
||||
<tag name="twig.extension" /> |
||||
</service> |
||||
|
||||
<service id="chamilo_admin_theme.theme_manager" class="%chamilo_admin_theme.theme_manager.class%"> |
||||
<argument type="service" id="service_container" /> |
||||
<argument>%chamilo_admin_theme.dependency_resolver.class%</argument> |
||||
</service> |
||||
|
||||
<service id="chamilo_admin_theme.setup_theme_listener" class="%chamilo_admin_theme.setup_theme_listener.class%"> |
||||
<argument type="service" id="chamilo_admin_theme.theme_manager"/> |
||||
<argument>%chamilo_admin_theme.css_base%</argument> |
||||
<argument>%chamilo_admin_theme.lte_admin%</argument> |
||||
<tag name="kernel.event_listener" event="kernel.controller" method="onKernelController" /> |
||||
</service> |
||||
<service id="chamilo_admin_theme.context_listener" class="Chamilo\ThemeBundle\EventListener\ContextListener"> |
||||
<argument type="service" id="service_container" /> |
||||
<tag name="kernel.event_listener" event="kernel.request" method="onRequest" /> |
||||
</service> |
||||
</services> |
||||
|
||||
</container> |
||||
|
@ -0,0 +1,5 @@ |
||||
body { |
||||
|
||||
margin-top: 70px; |
||||
|
||||
} |
@ -0,0 +1,37 @@ |
||||
<ol class="breadcrumb"> |
||||
<li> |
||||
<a href="{{ path('home') }}"> |
||||
<i class="fa fa-dashboard"></i> |
||||
{{ 'Home'|trans({}, 'ChamiloThemeBundle') }} |
||||
</a> |
||||
</li> |
||||
|
||||
{% if course is defined %} |
||||
<li> |
||||
<a href="{{ url('course_home', {'course': course }) }}"> |
||||
<i class="fa fa-book"></i> |
||||
{{ course.title }} |
||||
</a> |
||||
</li> |
||||
{% endif %} |
||||
|
||||
{% if tool.name is defined and tool.name != '' %} |
||||
<li> |
||||
<a href="{{ url('chamilo_'~ tool.name ~'_index', {'course': course }) }}"> |
||||
<i class="fa fa-cube"></i> |
||||
{{ tool.name }} |
||||
</a> |
||||
</li> |
||||
{% endif %} |
||||
|
||||
{#{% if active %}#} |
||||
{#{% for item in active %}#} |
||||
{#<li>#} |
||||
{#<a href="{{ item.route is empty ? '#' : '/' in item.route ? item.route : path(item.route, item.routeArgs) }}">#} |
||||
{#{{ item.label }}#} |
||||
{#</a>#} |
||||
{#</li>#} |
||||
{#{% endfor %}#} |
||||
{#{% endif %}#} |
||||
<li class="active">{{ title }}</li> |
||||
</ol> |
@ -0,0 +1,52 @@ |
||||
{% extends '@ChamiloTheme/Layout/base-layout.html.twig' %} |
||||
|
||||
{% block page_content %} |
||||
|
||||
<div class="row"> |
||||
<div class="col-md-4"> |
||||
|
||||
|
||||
</div> |
||||
<div class="col-md-4"> |
||||
|
||||
</div> |
||||
<div class="col-md-4"> |
||||
|
||||
</div> |
||||
</div> |
||||
|
||||
<div class="row"> |
||||
<div class="col-md-6"> |
||||
|
||||
<div class="box box-primary"> |
||||
<div class="box-header"> |
||||
<h3 class="box-title">Form Theme</h3> |
||||
</div> |
||||
<div class="box-body"> |
||||
{{ form(form) }} |
||||
</div> |
||||
<div class="box-footer"> |
||||
<div class="pull-right"> |
||||
<button type="reset" class="btn">Cancel</button> |
||||
<button type="submit" class="btn btn-primary">Submit</button> |
||||
</div> |
||||
|
||||
</div> |
||||
</div> |
||||
|
||||
</div> |
||||
<div class="col-md-6"> |
||||
<div class="box box-solid box-primary"> |
||||
{{ macro.box_header('built from macro', true, false, 'primary') }} |
||||
<div class="box-body"> |
||||
some content... |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
{% endblock %} |
||||
|
||||
{% block page_title %} Forms {% endblock %} |
||||
{% block page_subtitle %} demonstration {% endblock %} |
@ -0,0 +1 @@ |
||||
{% extends '@ChamiloTheme/Layout/base-layout.html.twig' %} |
@ -0,0 +1,94 @@ |
||||
{% extends '@ChamiloTheme/Layout/base-layout.html.twig' %} |
||||
{% block page_title %} Error {% endblock %} |
||||
{% block page_subtitle %} {{ status_code }} {% endblock %} |
||||
|
||||
{% block page_content %} |
||||
<div class="error-page"> |
||||
<h2 class="headline">{{ status_code }}</h2> |
||||
|
||||
<div class="error-content"> |
||||
<h3>{{ 'Something seems to have gone wrong'|trans() }}</h3> |
||||
|
||||
<p>{{ exception.message }}</p> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class=""> |
||||
|
||||
{% for n, position in exception.toarray %} |
||||
|
||||
<div class="box box-danger"> |
||||
<div class="box-header"> |
||||
<i class="fa fa-warning"></i> |
||||
|
||||
<h3 class="box-title">{{ position.class|abbr_class }}</h3> |
||||
</div> |
||||
<div class="box-body"> |
||||
|
||||
<div class="callout callout-danger"> |
||||
{{ position.message|nl2br|format_file_from_text }} |
||||
</div> |
||||
|
||||
<div class="box-group" id="box-{{ n }}"> |
||||
|
||||
|
||||
<!-- trace --> |
||||
<div class="panel box box-warning"> |
||||
<div class="box-header"> |
||||
<h4 class="box-title"> |
||||
<a data-toggle="collapse" data-parent="box-{{ n }}" |
||||
href="#trace-{{ n }}"> |
||||
{{ 'Stack Trace'|trans() }} |
||||
</a> |
||||
</h4> |
||||
</div> |
||||
<div id="trace-{{ n }}" class="panel-collapse collapse"> |
||||
<div class="box-body"> |
||||
<div class="panel"> |
||||
<ul class="timeline"> |
||||
{% for i, trace in position.trace %} |
||||
<li class="time-label"> |
||||
<span class="bg-red"> |
||||
Stack #{{ i }} |
||||
</span> |
||||
</li> |
||||
<li> |
||||
<i class="fa fa-code bg-blue"></i> |
||||
|
||||
<div class="timeline-item"> |
||||
<h3 class="timeline-header"> |
||||
{{ trace.file }} |
||||
</h3> |
||||
|
||||
<div class="timeline-body"> |
||||
{% if trace.function %} |
||||
at |
||||
<strong> |
||||
<abbr title="{{ trace.class }}">{{ trace.short_class }}</abbr> |
||||
{{ trace.type ~ trace.function }} |
||||
</strong> |
||||
({{ trace.args|format_args }}) |
||||
{% endif %} |
||||
|
||||
{% if trace.file is defined and trace.file and trace.line is defined and trace.line %} |
||||
{{ trace.function ? '<br />' : '' }} |
||||
in {{ trace.file|format_file(trace.line) }} |
||||
{{ trace.file|file_excerpt(trace.line) }} |
||||
|
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
</li> |
||||
{% endfor %} |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
|
||||
{% endblock %} |
@ -0,0 +1,269 @@ |
||||
{% import "ChamiloThemeBundle:Macros:box.html.twig" as macro_box %} |
||||
{% import "ChamiloThemeBundle:Macros:actions.html.twig" as macro_actions %} |
||||
{% import "ChamiloThemeBundle:Macros:buttons.html.twig" as macro_buttons %} |
||||
{% import "ChamiloThemeBundle:Macros:image.html.twig" as macro_image %} |
||||
{% import 'ChamiloThemeBundle:Macros:headers.html.twig' as macro_headers %} |
||||
<!doctype html> |
||||
<!--[if lt IE 7 ]> |
||||
<html lang="{{ app.request.locale }}" class="no-js ie6"> <![endif]--> |
||||
<!--[if IE 7 ]> |
||||
<html lang="{{ app.request.locale }}" class="no-js ie7"> <![endif]--> |
||||
<!--[if IE 8 ]> |
||||
<html lang="{{ app.request.locale }}" class="no-js ie8"> <![endif]--> |
||||
<!--[if IE 9 ]> |
||||
<html lang="{{ app.request.locale }}" class="no-js ie9"> <![endif]--> |
||||
<!--[if (gt IE 9)|!(IE)]><!--> |
||||
<html lang="{{ app.request.locale }}" class="no-js"> <!--<![endif]--> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
|
||||
{# Check settings in app/config/sonata/sonata_seo.yml #} |
||||
{{ sonata_seo_metadatas() }} |
||||
|
||||
<link href="https://chamilo.org/chamilo-lms/" rel="help"/> |
||||
<link href="https://chamilo.org/the-association/" rel="author"/> |
||||
<link href="https://chamilo.org/the-association/" rel="copyright"/> |
||||
<link rel="apple-touch-icon" href="{{ asset('apple-touch-icon.png') }}"/> |
||||
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}"/> |
||||
|
||||
<title> |
||||
{% block title %} |
||||
{{ chamilo_settings_get('platform.institution') }} - {{ chamilo_settings_get('platform.site_name') }} |
||||
{% endblock %} |
||||
</title> |
||||
|
||||
{# Check chamilo_css key in assetic.yml #} |
||||
{%- stylesheets '@chamilo_css' -%} |
||||
<link rel="stylesheet" href="{{ asset_url }}"/> |
||||
{% endstylesheets %} |
||||
|
||||
{% stylesheets |
||||
'@MopaBootstrapBundle/Resources/public/less/mopabootstrapbundle.less' |
||||
'@MopaBootstrapBundle/Resources/public/less/eyecon-datepicker.less' |
||||
%} |
||||
|
||||
<link href="{{ asset_url }}" type="text/css" rel="stylesheet" media="screen" /> |
||||
{% endstylesheets %} |
||||
|
||||
{# Chamilo theme #} |
||||
{% set theme = chamilo_settings_get('platform.theme') %} |
||||
|
||||
{% set bug_notification_link = '' %} |
||||
{% set help_content = '' %} |
||||
{% set header_extra_content = '' %} |
||||
|
||||
{% set template = 'default' %} |
||||
{% set notification_menu = '' %} |
||||
{% set accessibility = '' %} |
||||
{% set containerClass = '' %} |
||||
{% set breadcrumb = '' %} |
||||
{% set user_notifications = '' %} |
||||
{% set message_url = '' %} |
||||
{% set profile_link = '' %} |
||||
{% set message_link = '' %} |
||||
|
||||
<link rel="stylesheet" href="{{ asset('bundles/chamilocore/css/base.css') }}"/> |
||||
<link rel="stylesheet" href="{{ asset('bundles/chamilocore/css/scorm.css') }}"/> |
||||
<link rel="stylesheet" href="{{ asset('bundles/chamilocore/css/themes/'~ theme ~'/learnpath.css') }}"/> |
||||
<link rel="stylesheet" href="{{ asset('bundles/chamilocore/css/themes/'~ theme ~'/default.css') }}"/> |
||||
|
||||
<link rel="stylesheet" media="print" href="{{ asset('bundles/chamilocore/css/print.css') }}"/> |
||||
<link rel="stylesheet" media="print" href="{{ asset('bundles/chamilocore/css/themes/'~ theme ~'/print.css') }}"/> |
||||
|
||||
<script src="{{ asset('bundles/chamilocore/components/modernizr/modernizr.js') }}"></script> |
||||
|
||||
{# Check chamilo_js key in assetic.yml #} |
||||
{% block javascripts %} |
||||
{%- javascripts '@chamilo_js' -%} |
||||
<script src="{{ asset_url }} "></script> |
||||
{% endjavascripts %} |
||||
|
||||
<script src="{{ asset('bundles/ivoryckeditor/ckeditor.js') }}" type="text/javascript"></script> |
||||
<script src="{{ asset('bundles/fosjsrouting/js/router.js') }}"></script> |
||||
<script src="{{ path('fos_js_routing_js', {"callback": "fos.Router.setData"}) }}"></script> |
||||
|
||||
{% block chamilo_header_js %} |
||||
{% include '@ChamiloTheme/Layout/header.js.twig' %} |
||||
{% endblock %} |
||||
|
||||
{% javascripts |
||||
'@MopaBootstrapBundle/Resources/public/js/mopabootstrap-collection.js' |
||||
'@MopaBootstrapBundle/Resources/public/js/mopabootstrap-subnav.js' |
||||
'@MopaBootstrapBundle/Resources/public/js/eyecon-bootstrap-datepicker.js' |
||||
%} |
||||
<script type="text/javascript" src="{{ asset_url | replace({'/app_dev.php': ''}) }}"></script> |
||||
{% endjavascripts %} |
||||
</head> |
||||
{#<body class="{{ admin_skin|default('skin-blue')}}">#} |
||||
<body> |
||||
<noscript>{{ "NoJavascript" | trans }}</noscript> |
||||
|
||||
{#{% if show_header == true %}#} |
||||
{% block chamilo_wrap %} |
||||
<div id="page-wrap"> |
||||
<!-- page section --> |
||||
{# Bug and help notifications #} |
||||
{#{% block help_notifications %}#} |
||||
{#<ul id="navigation" class="notification-panel">#} |
||||
{#{{ help_content }}#} |
||||
{#{{ bug_notification_link }}#} |
||||
{#</ul>#} |
||||
{#{% endblock %}#} |
||||
|
||||
{# topbar #} |
||||
{% block topbar %} |
||||
{% include "@template_style/layout/topbar.html.twig" %} |
||||
{% if show_toolbar == 1 %} |
||||
{#<div class="clear-header"></div>#} |
||||
{% endif %} |
||||
{% endblock %} |
||||
|
||||
<header> |
||||
<div class="extra-header"> |
||||
{{ header_extra_content }} |
||||
</div> |
||||
|
||||
<section id="main" class="container"> |
||||
{% if plugin_header_main %} |
||||
<div class="row"> |
||||
<div class="col-lg-12"> |
||||
{{ plugin_header_main }} |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
<div class="row"> |
||||
<div class="col-lg-3"> |
||||
<div class="logo"> |
||||
<a href="{{ url('home') }}"> |
||||
<img src="{{ asset('bundles/chamilocore/css/themes/'~ theme ~'/images/header-logo.png') }}"/> |
||||
</a> |
||||
</div> |
||||
</div> |
||||
<div class="col-lg-9"> |
||||
<div class="col-sm-4"> |
||||
{% if plugin_header_left is not null %} |
||||
<div id="plugin_header_left"> |
||||
{{ plugin_header_left }} |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
<div class="col-sm-4"> |
||||
{% if plugin_header_center is not null %} |
||||
<div id="plugin_header_center"> |
||||
{{ plugin_header_center }} |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
<div class="col-sm-4"> |
||||
{% if plugin_header_right is not null %} |
||||
<div id="plugin_header_right"> |
||||
{{ plugin_header_right }} |
||||
</div> |
||||
{% endif %} |
||||
<div class="section-notifications"> |
||||
<ul id="notifications" class="nav nav-pills pull-right"> |
||||
{{ notification_menu }} |
||||
</ul> |
||||
</div> |
||||
{{ accessibility }} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</section> |
||||
|
||||
<section id="menu-bar"> |
||||
{# menu #} |
||||
{% block menu %} |
||||
<nav class="navbar navbar-default"> |
||||
<div class="container"> |
||||
{{ mopa_bootstrap_menu('ChamiloCoreBundle:NavBuilder:leftMenu', {'automenu': 'navbar', 'stacked':true}) }} |
||||
<div style="float:right"> |
||||
{{ mopa_bootstrap_menu('ChamiloCoreBundle:NavBuilder:rightMenu', {'automenu': 'navbar'} ) }} |
||||
</div> |
||||
|
||||
</div> |
||||
</nav> |
||||
{#{% include "@template_style/layout/menu.html.twig" %}#} |
||||
{% endblock %} |
||||
</section> |
||||
{#<section id="breadcrumb-bar">#} |
||||
{#<div class="container">#} |
||||
{#{# breadcrumb #}#} |
||||
{#{% block breadcrumb %}#} |
||||
{#{{ breadcrumb }}#} |
||||
{#{% endblock %}#} |
||||
{#</div>#} |
||||
{#</section>#} |
||||
</header> |
||||
|
||||
<div id="top_main_content" class="container"> |
||||
|
||||
{# course navigation links/shortcuts need to be activated by the admin #} |
||||
{% include "@template_style/layout/course_navigation.html.twig" %} |
||||
{#{% endif %}#} |
||||
|
||||
{% block chamilo_header %} |
||||
{#<header class="header">#} |
||||
{#{% block chamilo_logo %}#} |
||||
{#<a href="#" class="logo">#} |
||||
{#Chamilo#} |
||||
{#{#{{- chamilo_settings_get('platform.institution') -}}#}#} |
||||
{#</a>#} |
||||
{#{% endblock %}#} |
||||
{#{% block chamilo_main_navbar %}#} |
||||
{#<!-- Header Navbar: style can be found in header.less -->#} |
||||
{#{% endblock %}#} |
||||
{#</header>#} |
||||
{% endblock %} |
||||
|
||||
{% block chamilo_content %} |
||||
{#Check sonata_block.yml settings#} |
||||
{#{% include 'SonataSeoBundle:Block:_facebook_sdk.html.twig' %}#} |
||||
{#{% include 'SonataSeoBundle:Block:_twitter_sdk.html.twig' %}#} |
||||
{#{% include 'SonataSeoBundle:Block:_pinterest_sdk.html.twig' %}#} |
||||
{% block page_content %} |
||||
{% endblock %} |
||||
{% endblock %} |
||||
|
||||
{#<!-- Right side column. Contains the navbar and content of the page -->#} |
||||
{#<div class="col-md-9">#} |
||||
{#<!-- Content Header (Page header) -->#} |
||||
{#{% block content_header %}#} |
||||
{#<section class="content-header">#} |
||||
{#{% block content_header_title %}#} |
||||
{#<h1>#} |
||||
{#{% block page_title %}{% endblock %}#} |
||||
{#<small>{% block page_subtitle %}{% endblock %}</small>#} |
||||
{#</h1>#} |
||||
{#{% endblock %}#} |
||||
|
||||
{#{% block chamilo_breadcrumb %}#} |
||||
{#{{ render(controller('ChamiloThemeBundle:Breadcrumb:breadcrumb', {'request':app.request, 'title' : block('page_title')})) }}#} |
||||
{#{% endblock %}#} |
||||
{#</section>#} |
||||
{#{% endblock %}#} |
||||
|
||||
{#<!-- Main content -->#} |
||||
{#<section class="content">#} |
||||
{#{% block page_content %}{% endblock %}#} |
||||
{#</section>#} |
||||
{#<!-- /.content -->#} |
||||
{#</div>#} |
||||
{#<!-- /.right-side -->#} |
||||
|
||||
{% endblock %} |
||||
</div> |
||||
</div> |
||||
{# End wrapper div #} |
||||
|
||||
{% block chamilo_footer %} |
||||
{% include "@template_style/layout/footer.html.twig" %} |
||||
{% endblock %} |
||||
|
||||
{% block chamilo_footer_js %} |
||||
{% include '@ChamiloTheme/Layout/footer.js.twig' %} |
||||
{% endblock %} |
||||
|
||||
{% endblock %} {# End wrapper block#} |
||||
</body> |
||||
</html> |
@ -0,0 +1,98 @@ |
||||
<script> |
||||
/* Makes row highlighting possible */ |
||||
$(document).ready( function() { |
||||
// Date time settings. |
||||
moment.locale('{{ app.request.locale }}'); |
||||
$.datepicker.setDefaults($.datepicker.regional["{{ app.request.locale }}"]); |
||||
$.datepicker.regional["local"] = $.datepicker.regional["{{ app.request.locale }}"]; |
||||
|
||||
// Chosen select |
||||
$(".chzn-select").chosen({ |
||||
disable_search_threshold: 10, |
||||
no_results_text: '{{ 'SearchNoResultsFound' | trans }}', |
||||
placeholder_text_multiple: '{{ 'SelectSomeOptions' | trans }}', |
||||
placeholder_text_single: '{{ 'SelectAnOption' | trans }}', |
||||
width: "100%" |
||||
}); |
||||
|
||||
// Bootstrap tabs. |
||||
$('.tab-wrapper a').click(function (e) { |
||||
e.preventDefault(); |
||||
$(this).tab('show'); |
||||
|
||||
//$('#tabs a:first').tab('show') // Select first tab |
||||
}); |
||||
|
||||
// Fixes bug when loading links inside a tab. |
||||
$('.tab-wrapper .tab-pane a').unbind(); |
||||
|
||||
/** |
||||
* Advanced options |
||||
* Usage |
||||
* <a id="link" href="url">Advanced</a> |
||||
* <div id="link_options"> |
||||
* hidden content :) |
||||
* </div> |
||||
* */ |
||||
$(".advanced_options").on("click", function (event) { |
||||
event.preventDefault(); |
||||
var id = $(this).attr('id') + '_options'; |
||||
var button = $(this); |
||||
button.toggleClass('active'); |
||||
$("#" + id).toggle(); |
||||
}); |
||||
|
||||
/** |
||||
* <a class="advanced_options_open" href="http://" rel="div_id">Open</a> |
||||
* <a class="advanced_options_close" href="http://" rel="div_id">Close</a> |
||||
* <div id="div_id">Div content</div> |
||||
* */ |
||||
$(".advanced_options_open").on("click", function (event) { |
||||
event.preventDefault(); |
||||
var id = $(this).attr('rel'); |
||||
$("#" + id).show(); |
||||
}); |
||||
|
||||
$(".advanced_options_close").on("click", function (event) { |
||||
event.preventDefault(); |
||||
var id = $(this).attr('rel'); |
||||
$("#" + id).hide(); |
||||
}); |
||||
|
||||
// Adv multi-select search input. |
||||
$('.select_class_filter').on('focus', function () { |
||||
var inputId = $(this).attr('id'); |
||||
inputId = inputId.replace('-filter', ''); |
||||
$("#" + inputId).filterByText($("#" + inputId + "-filter")); |
||||
}); |
||||
|
||||
$(".jp-jplayer audio").addClass('skip'); |
||||
|
||||
// Mediaelement |
||||
jQuery('video:not(.skip), audio:not(.skip)').mediaelementplayer(/* Options */); |
||||
|
||||
// Table highlight. |
||||
$("form .data_table input:checkbox").click(function () { |
||||
if ($(this).is(":checked")) { |
||||
$(this).parentsUntil("tr").parent().addClass("row_selected"); |
||||
|
||||
} else { |
||||
$(this).parentsUntil("tr").parent().removeClass("row_selected"); |
||||
} |
||||
}); |
||||
|
||||
/* For non HTML5 browsers */ |
||||
if ($("#formLogin".length > 1)) { |
||||
$("input[name=login]").focus(); |
||||
} |
||||
|
||||
/* For IOS users */ |
||||
$('.autocapitalize_off').attr('autocapitalize', 'off'); |
||||
|
||||
// Tool tip (in exercises) |
||||
var tip_options = { |
||||
placement: 'right' |
||||
}; |
||||
$('.boot-tooltip').tooltip(tip_options); |
||||
}); |
||||
</script> |
@ -0,0 +1,164 @@ |
||||
{% extends 'form_div_layout.html.twig' %} |
||||
|
||||
{% block widget_attributes %} |
||||
{% if attr.class is defined %} |
||||
{% set class = attr.class ~ ' form-control' %} |
||||
{% else %} |
||||
{% set class = 'form-control' %} |
||||
{% endif %} |
||||
{% set attr = attr|merge({'class' : class}) %} |
||||
{{ parent () }} |
||||
{% endblock widget_attributes %} |
||||
|
||||
{% block choice_widget_expanded %} |
||||
{% spaceless %} |
||||
<div {{ block('widget_container_attributes') }}> |
||||
{% for child in form %} |
||||
{{ form_widget(child) }} |
||||
{% endfor %} |
||||
</div> |
||||
{% endspaceless %} |
||||
{% endblock choice_widget_expanded %} |
||||
|
||||
{% block choice_widget_collapsed %} |
||||
{% set attr = attr|merge({'class' : 'form-control'}) %} |
||||
{{ parent() }} |
||||
{% endblock %} |
||||
|
||||
{% block checkbox_widget %} |
||||
<div class="checkbox"> |
||||
{% spaceless %} |
||||
{% if not compound %} |
||||
{% set label_attr = label_attr|merge({'for': id}) %} |
||||
{% endif %} |
||||
{% if required %} |
||||
{% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %} |
||||
{% endif %} |
||||
{% if label is empty %} |
||||
{% set label = name|humanize %} |
||||
{% endif %} |
||||
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}> |
||||
<input type="checkbox" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} /> |
||||
{% if label is not sameas(false) %} |
||||
{{ label|trans({}, translation_domain) }} |
||||
{% endif %} |
||||
</label> |
||||
{% endspaceless %} |
||||
</div> |
||||
{% endblock checkbox_widget %} |
||||
|
||||
{% block radio_widget %} |
||||
<div class="radio"> |
||||
{% spaceless %} |
||||
{% if not compound %} |
||||
{% set label_attr = label_attr|merge({'for': id}) %} |
||||
{% endif %} |
||||
{% if required %} |
||||
{% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %} |
||||
{% endif %} |
||||
{% if label is empty %} |
||||
{% set label = name|humanize %} |
||||
{% endif %} |
||||
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}> |
||||
<input type="radio" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} /> |
||||
{% if label is not sameas(false) %} |
||||
{{ label|trans({}, translation_domain) }} |
||||
{% endif %} |
||||
</label> |
||||
{% endspaceless %} |
||||
</div> |
||||
{% endblock radio_widget %} |
||||
|
||||
{% block date_widget %} |
||||
{% if widget == 'single_text' %} |
||||
<div class="input-group"> |
||||
<div class="input-group-addon"> |
||||
<i class="fa fa-calendar"></i> |
||||
</div> |
||||
|
||||
{% if attr.class is defined %} |
||||
{% set class = attr.class ~ ' timepicker' %} |
||||
{% else %} |
||||
{% set class = ' timepicker' %} |
||||
{% endif %} |
||||
{% set attr = attr|merge({'class' : class, 'data-datepicker':'on'}) %} |
||||
|
||||
{{ block('form_widget_simple') }} |
||||
</div> |
||||
{% else %} |
||||
{% set date_pattern = '<div class="row">' ~ date_pattern ~ '</div>'|raw %} |
||||
{{ date_pattern|replace({ |
||||
'{{ year }}' : '<div class="col-xs-4">{{ year }}</div>', |
||||
'{{ month }}' : '<div class="col-xs-4">{{ month }}</div>', |
||||
'{{ day }}' : '<div class="col-xs-4">{{ day }}</div>', |
||||
})|raw|replace({ |
||||
'{{ year }}': form_widget(form.year), |
||||
'{{ month }}': form_widget(form.month), |
||||
'{{ day }}': form_widget(form.day), |
||||
})|raw }} |
||||
|
||||
{% endif %} |
||||
{% endblock %} |
||||
|
||||
{% block time_widget %} |
||||
{% if widget == 'single_text' %} |
||||
<div class="bootstrap-timepicker"> |
||||
<div class="input-group"> |
||||
{% if attr.class is defined %} |
||||
{% set class = attr.class ~ ' timepicker' %} |
||||
{% else %} |
||||
{% set class = ' timepicker' %} |
||||
{% endif %} |
||||
{% set attr = attr|merge({'class' : class, 'data-timepicker':'on'}) %} |
||||
{{ block('form_widget_simple') }} |
||||
<div class="input-group-addon add-on"> |
||||
<i class="fa fa-clock-o"></i> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% else %} |
||||
{{ parent() }} |
||||
{% endif %} |
||||
{% endblock %} |
||||
|
||||
{% block form_row %} |
||||
{% set types = form.vars.block_prefixes %} |
||||
{% if 'checkbox' in types or 'radio' in types %} |
||||
<div class="form-group {{ errors|length > 0 ? 'has-error has-feedback' : '' }}"> |
||||
{{ form_widget(form) }} |
||||
{{ form_errors(form) }} |
||||
</div> |
||||
{% else %} |
||||
<div class="form-group {{ errors|length > 0 ? 'has-error has-feedback' : '' }}"> |
||||
{{ form_label(form) }} |
||||
{{ form_widget(form) }} |
||||
{{ form_errors(form) }} |
||||
</div> |
||||
{% endif %} |
||||
{% endblock %} |
||||
|
||||
{% block form_label %} |
||||
|
||||
{% if help is defined %} |
||||
<a href="#" data-toggle="tooltip" data-original-title="{{ help }}"><i class="fa fa-question-circle"></i></a> |
||||
{% endif %} |
||||
|
||||
{{ parent() }} |
||||
{% if required %} |
||||
<span class="required" title="Dies ist ein Pflichtfeld">*</span> |
||||
{% endif %} |
||||
|
||||
{% endblock form_label %} |
||||
|
||||
{% block form_errors %} |
||||
{% spaceless %} |
||||
{% if errors|length > 0 %} |
||||
<ul class="list-unstyled"> |
||||
{% for error in errors %} |
||||
<li class="text-danger">{{ error.message }}</li> |
||||
{% endfor %} |
||||
</ul> |
||||
{% endif %} |
||||
{% endspaceless %} |
||||
{% endblock form_errors %} |
||||
|
@ -0,0 +1,453 @@ |
||||
<script> |
||||
// External plugins not part of the default Ckeditor package. |
||||
var plugins = [ |
||||
'asciimath', |
||||
'asciisvg', |
||||
'audio', |
||||
'ckeditor_wiris', |
||||
'dialogui', |
||||
'glossary', |
||||
'leaflet', |
||||
'mapping', |
||||
'maximize', |
||||
'mathjax', |
||||
'oembed', |
||||
'toolbar', |
||||
'toolbarswitch', |
||||
'video', |
||||
'wikilink', |
||||
'wordcount', |
||||
'youtube' |
||||
]; |
||||
|
||||
plugins.forEach(function (plugin) { |
||||
CKEDITOR.plugins.addExternal(plugin, '{{ asset('bundles/chamilocore/ckeditor/plugins/') }}' + plugin + '/'); |
||||
}); |
||||
|
||||
// basic plugins |
||||
plugins = [ |
||||
'adobeair', |
||||
'ajax', |
||||
'docprops', |
||||
'iframedialog', |
||||
'lineutils', |
||||
'sourcedialog', |
||||
'stylesheetparser', |
||||
'sharedspace', |
||||
//'uicolor', |
||||
'widget', |
||||
'tableresize', |
||||
'xml' |
||||
]; |
||||
|
||||
plugins.forEach(function (plugin) { |
||||
CKEDITOR.plugins.addExternal(plugin, '{{ asset('bundles/chamilocore/components/ckeditor/plugins/') }}' + plugin + '/'); |
||||
}); |
||||
|
||||
/* Global chat variables */ |
||||
var ajax_url = '{{ url('web.ajax') }}chat.ajax.php'; |
||||
var online_button = '{{ asset('bundles/chamilocore/img/statusonline.png') }}'; |
||||
var offline_button = '{{ asset('bundles/chamilocore/img/statusoffline.png') }}'; |
||||
var connect_lang = '{{ "ChatConnected"|trans }}'; |
||||
var disconnect_lang = '{{ "ChatDisconnected"|trans }}'; |
||||
|
||||
/** |
||||
* Function use to load templates in a div |
||||
**/ |
||||
var showTemplates = function (ckeditorName) { |
||||
var editorName = 'content'; |
||||
if (ckeditorName && ckeditorName.length > 0) { |
||||
editorName = ckeditorName; |
||||
} |
||||
CKEDITOR.editorConfig(CKEDITOR.config); |
||||
CKEDITOR.loadTemplates(CKEDITOR.config.templates_files, function (a){ |
||||
var templatesConfig = CKEDITOR.getTemplates("default"); |
||||
|
||||
var $templatesUL = $("<ul>"); |
||||
|
||||
$.each(templatesConfig.templates, function () { |
||||
var template = this; |
||||
var $templateLi = $("<li>"); |
||||
|
||||
var templateHTML = "<img src=\"" + templatesConfig.imagesPath + template.image + "\" ><div>"; |
||||
templateHTML += "<b>" + template.title + "</b>"; |
||||
|
||||
if (template.description) { |
||||
templateHTML += "<div class=description>" + template.description + "</div>"; |
||||
} |
||||
|
||||
templateHTML += "</div>"; |
||||
|
||||
$("<a>", { |
||||
href: "#", |
||||
html: templateHTML, |
||||
click: function (e) { |
||||
e.preventDefault(); |
||||
if (CKEDITOR.instances[editorName]) { |
||||
CKEDITOR.instances[editorName].setData(template.html, function () { |
||||
this.checkDirty(); |
||||
}); |
||||
} |
||||
} |
||||
}).appendTo($templateLi); |
||||
$templatesUL.append($templateLi); |
||||
}); |
||||
$templatesUL.appendTo("#frmModel"); |
||||
}); |
||||
}; |
||||
|
||||
$(document).ready(function() { |
||||
$("#open-view-list").click(function(){ |
||||
$("#student-list-work").fadeIn(300); |
||||
}); |
||||
|
||||
$("#closed-view-list").click(function(){ |
||||
$("#student-list-work").fadeOut(300); |
||||
}); |
||||
|
||||
check_brand(); |
||||
|
||||
//if exists the toolbar admin |
||||
if($('#toolbar-admin').length){ |
||||
var heigthToolBar= $('#toolbar-admin').height(); |
||||
$('header').css('margin-top', heigthToolBar+'px'); |
||||
$('#page-back').css('padding-top', heigthToolBar+20+'px'); |
||||
} |
||||
|
||||
// Removes the yellow input in Chrome |
||||
if (navigator.userAgent.toLowerCase().indexOf("chrome") >= 0) { |
||||
$(window).load(function(){ |
||||
$('input:-webkit-autofill').each(function(){ |
||||
var text = $(this).val(); |
||||
var name = $(this).attr('name'); |
||||
$(this).after(this.outerHTML).remove(); |
||||
$('input[name=' + name + ']').val(text); |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
$(".accordion_jquery").accordion({ |
||||
autoHeight: false, |
||||
active: false, // all items closed by default |
||||
collapsible: true, |
||||
header: ".accordion-heading" |
||||
}); |
||||
|
||||
// Global popup |
||||
$('body').on('click', 'a.ajax', function(e) { |
||||
e.preventDefault(); |
||||
|
||||
var contentUrl = this.href, |
||||
loadModalContent = $.get(contentUrl), |
||||
self = $(this); |
||||
|
||||
$.when(loadModalContent).done(function(modalContent) { |
||||
var modalDialog = $('#global-modal').find('.modal-dialog'), |
||||
modalSize = self.data('size') || get_url_params(contentUrl, 'modal_size'), |
||||
modalWidth = self.data('width') || get_url_params(contentUrl, 'width'), |
||||
modalTitle = self.data('title') || ' '; |
||||
|
||||
modalDialog.removeClass('modal-lg modal-sm').css('width', ''); |
||||
|
||||
if (modalSize) { |
||||
switch (modalSize) { |
||||
case 'lg': |
||||
modalDialog.addClass('modal-lg'); |
||||
break; |
||||
case 'sm': |
||||
modalDialog.addClass('modal-sm'); |
||||
break; |
||||
} |
||||
} else if (modalWidth) { |
||||
modalDialog.css('width', modalWidth + 'px'); |
||||
} |
||||
|
||||
$('#global-modal').find('.modal-title').text(modalTitle); |
||||
$('#global-modal').find('.modal-body').html(modalContent); |
||||
$('#global-modal').modal('show'); |
||||
}); |
||||
}); |
||||
|
||||
$('a.expand-image').on('click', function(e) { |
||||
e.preventDefault(); |
||||
var title = $(this).attr('title'); |
||||
var image = new Image(); |
||||
image.onload = function() { |
||||
if (title) { |
||||
$('#expand-image-modal').find('.modal-title').text(title); |
||||
} else { |
||||
$('#expand-image-modal').find('.modal-title').html(' '); |
||||
} |
||||
|
||||
$('#expand-image-modal').find('.modal-body').html(image); |
||||
$('#expand-image-modal').modal({ |
||||
show: true |
||||
}); |
||||
}; |
||||
image.src = this.href; |
||||
}); |
||||
|
||||
// Global confirmation |
||||
$('.popup-confirmation').on('click', function() { |
||||
showConfirmationPopup(this); |
||||
return false; |
||||
}); |
||||
|
||||
// old jquery.menu.js |
||||
$('#navigation a').stop().animate({ |
||||
'marginLeft':'50px' |
||||
},1000); |
||||
|
||||
$('#navigation > li').hover( |
||||
function () { |
||||
$('a',$(this)).stop().animate({ |
||||
'marginLeft':'1px' |
||||
},200); |
||||
}, |
||||
function () { |
||||
$('a',$(this)).stop().animate({ |
||||
'marginLeft':'50px' |
||||
},200); |
||||
} |
||||
); |
||||
|
||||
/* Make responsive image maps */ |
||||
$('map').imageMapResize(); |
||||
|
||||
jQuery.fn.filterByText = function(textbox) { |
||||
return this.each(function() { |
||||
var select = this; |
||||
var options = []; |
||||
$(select).find('option').each(function() { |
||||
options.push({value: $(this).val(), text: $(this).text()}); |
||||
}); |
||||
$(select).data('options', options); |
||||
|
||||
$(textbox).bind('change keyup', function() { |
||||
var options = $(select).empty().data('options'); |
||||
var search = $.trim($(this).val()); |
||||
var regex = new RegExp(search,"gi"); |
||||
|
||||
$.each(options, function(i) { |
||||
var option = options[i]; |
||||
if(option.text.match(regex) !== null) { |
||||
$(select).append( |
||||
$('<option>').text(option.text).val(option.value) |
||||
); |
||||
} |
||||
}); |
||||
}); |
||||
}); |
||||
}; |
||||
}); |
||||
|
||||
$(window).resize(function() { |
||||
check_brand(); |
||||
}); |
||||
|
||||
$(document).scroll(function() { |
||||
|
||||
//Exercise warning fixed at the top |
||||
var fixed = $("#exercise_clock_warning"); |
||||
if (fixed.length) { |
||||
if (!fixed.attr('data-top')) { |
||||
// If already fixed, then do nothing |
||||
if (fixed.hasClass('subnav-fixed')) return; |
||||
// Remember top position |
||||
var offset = fixed.offset(); |
||||
fixed.attr('data-top', offset.top); |
||||
fixed.css('width', '100%'); |
||||
} |
||||
|
||||
if (fixed.attr('data-top') - fixed.outerHeight() <= $(this).scrollTop()) { |
||||
fixed.addClass('subnav-fixed'); |
||||
fixed.css('width', '100%'); |
||||
} else { |
||||
fixed.removeClass('subnav-fixed'); |
||||
fixed.css('width', '200px'); |
||||
} |
||||
} |
||||
|
||||
// Admin -> Settings toolbar. |
||||
if ($('body').width() > 959) { |
||||
if ($('.new_actions').length) { |
||||
if (!$('.new_actions').attr('data-top')) { |
||||
// If already fixed, then do nothing |
||||
if ($('.new_actions').hasClass('new_actions-fixed')) return; |
||||
// Remember top position |
||||
var offset = $('.new_actions').offset(); |
||||
|
||||
var more_top = 0; |
||||
if ($('.subnav').hasClass('new_actions-fixed')) { |
||||
more_top = 50; |
||||
} |
||||
$('.new_actions').attr('data-top', offset.top + more_top); |
||||
} |
||||
|
||||
if ($('.new_actions').attr('data-top') - $('.new_actions').outerHeight() <= $(this).scrollTop()) { |
||||
$('.new_actions').addClass('new_actions-fixed'); |
||||
} else { |
||||
$('.new_actions').removeClass('new_actions-fixed'); |
||||
} |
||||
} |
||||
} |
||||
|
||||
// Bottom actions. |
||||
if ($('.bottom_actions').length) { |
||||
if (!$('.bottom_actions').attr('data-top')) { |
||||
// If already fixed, then do nothing |
||||
if ($('.bottom_actions').hasClass('bottom_actions_fixed')) return; |
||||
|
||||
// Remember top position |
||||
var offset = $('.bottom_actions').offset(); |
||||
$('.bottom_actions').attr('data-top', offset.top); |
||||
} |
||||
|
||||
if ($('.bottom_actions').attr('data-top') > $('body').outerHeight()) { |
||||
if ( ($('.bottom_actions').attr('data-top') - $('body').outerHeight() - $('.bottom_actions').outerHeight()) >= $(this).scrollTop()) { |
||||
$('.bottom_actions').addClass('bottom_actions_fixed'); |
||||
$('.bottom_actions').css("width", "100%"); |
||||
} else { |
||||
$('.bottom_actions').css("width", ""); |
||||
$('.bottom_actions').removeClass('bottom_actions_fixed'); |
||||
} |
||||
} else { |
||||
if ( ($('.bottom_actions').attr('data-top') - $('.bottom_actions').outerHeight()) <= $(this).scrollTop()) { |
||||
$('.bottom_actions').addClass('bottom_actions_fixed'); |
||||
$('.bottom_actions').css("width", "100%"); |
||||
} else { |
||||
$('.bottom_actions').removeClass('bottom_actions_fixed'); |
||||
$('.bottom_actions').css("width", ""); |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
|
||||
function get_url_params(q, attribute) { |
||||
var vars; |
||||
var hash; |
||||
if (q != undefined) { |
||||
q = q.split('&'); |
||||
for(var i = 0; i < q.length; i++){ |
||||
hash = q[i].split('='); |
||||
if (hash[0] == attribute) { |
||||
return hash[1]; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
function check_brand() { |
||||
if ($('.subnav').length) { |
||||
if ($(window).width() >= 969) { |
||||
$('.subnav .brand').hide(); |
||||
} else { |
||||
$('.subnav .brand').show(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
function showConfirmationPopup(obj, urlParam) { |
||||
if (urlParam) { |
||||
url = urlParam |
||||
} else { |
||||
url = obj.href; |
||||
} |
||||
|
||||
var dialog = $("#dialog"); |
||||
if ($("#dialog").length == 0) { |
||||
dialog = $('<div id="dialog" style="display:none">{{ "ConfirmYourChoice" | trans }} </div>').appendTo('body'); |
||||
} |
||||
|
||||
var width_value = 350; |
||||
var height_value = 150; |
||||
var resizable_value = true; |
||||
|
||||
var new_param = get_url_params(url, 'width'); |
||||
if (new_param) { |
||||
width_value = new_param; |
||||
} |
||||
|
||||
var new_param = get_url_params(url, 'height') |
||||
if (new_param) { |
||||
height_value = new_param; |
||||
} |
||||
|
||||
var new_param = get_url_params(url, 'resizable'); |
||||
if (new_param) { |
||||
resizable_value = new_param; |
||||
} |
||||
|
||||
// Show dialog |
||||
dialog.dialog({ |
||||
modal : true, |
||||
width : width_value, |
||||
height : height_value, |
||||
resizable : resizable_value, |
||||
buttons: [ |
||||
{ |
||||
text: '{{ 'Yes' | trans }}', |
||||
click: function() { |
||||
window.location = url; |
||||
}, |
||||
icons:{ |
||||
primary:'ui-icon-locked' |
||||
} |
||||
}, |
||||
{ |
||||
text: '{{ 'No' | trans }}', |
||||
click: function() { $(this).dialog("close"); }, |
||||
icons:{ |
||||
primary:'ui-icon-locked' |
||||
} |
||||
} |
||||
] |
||||
}); |
||||
// prevent the browser to follow the link |
||||
return false; |
||||
} |
||||
|
||||
function setCheckbox(value, table_id) { |
||||
checkboxes = $("#"+table_id+" input:checkbox"); |
||||
$.each(checkboxes, function(index, checkbox) { |
||||
checkbox.checked = value; |
||||
if (value) { |
||||
$(checkbox).parentsUntil("tr").parent().addClass("row_selected"); |
||||
} else { |
||||
$(checkbox).parentsUntil("tr").parent().removeClass("row_selected"); |
||||
} |
||||
}); |
||||
return false; |
||||
} |
||||
|
||||
function action_click(element, table_id) { |
||||
d = $("#"+table_id); |
||||
if (!confirm('{{ "ConfirmYourChoice"|trans }}')) { |
||||
return false; |
||||
} else { |
||||
var action =$(element).attr("data-action"); |
||||
$('#'+table_id+' input[name="action"] ').attr("value", action); |
||||
d.submit(); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Generic function to replace the deprecated jQuery toggle function |
||||
* @param inId : id of block to hide / unhide |
||||
* @param inIdTxt : id of the button |
||||
* @param inTxtHide : text one of the button |
||||
* @param inTxtUnhide : text two of the button |
||||
* @todo : allow to detect if text is from a button or from a <a> |
||||
*/ |
||||
function hideUnhide(inId, inIdTxt, inTxtHide, inTxtUnhide) |
||||
{ |
||||
if ($('#'+inId).css("display") == "none") { |
||||
$('#'+inId).show(400); |
||||
$('#'+inIdTxt).attr("value", inTxtUnhide); |
||||
} else { |
||||
$('#'+inId).hide(400); |
||||
$('#'+inIdTxt).attr("value", inTxtHide); |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,48 @@ |
||||
{% import "ChamiloThemeBundle:Macros:box.html.twig" as macro %} |
||||
<!doctype html> |
||||
<!--[if lt IE 7 ]><html lang="en" class="no-js ie6"> <![endif]--> |
||||
<!--[if IE 7 ]><html lang="en" class="no-js ie7"> <![endif]--> |
||||
<!--[if IE 8 ]><html lang="en" class="no-js ie8"> <![endif]--> |
||||
<!--[if IE 9 ]><html lang="en" class="no-js ie9"> <![endif]--> |
||||
<!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"> <!--<![endif]--> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta name="author" content=""> |
||||
<meta name="keywords" content=""> |
||||
<meta name="viewport" content="width=device-width,initial-scale=1"> |
||||
<title> |
||||
{% block title %} |
||||
{#{{ chamilo_settings_get('platform.institution') }} - {{ chamilo_settings_get('platform.site_name') }}#} |
||||
Chamilo |
||||
{% endblock %} |
||||
</title> |
||||
|
||||
{# Check chamilo_css key in assetic.yml #} |
||||
{#{%- stylesheets '@chamilo_css' -%}#} |
||||
{#<link rel="stylesheet" href="{{ asset_url }}" />#} |
||||
{#{% endstylesheets %}#} |
||||
|
||||
{#{% block javascripts %}#} |
||||
{#{%- javascripts '@chamilo_js' -%}#} |
||||
{#<script src="{{ asset_url }}"></script>#} |
||||
{#{% endjavascripts %}#} |
||||
{#{% endblock %}#} |
||||
|
||||
{% block stylesheets %} |
||||
{% for stylesheet in sonata_admin.adminPool.getOption('stylesheets', []) %} |
||||
<link rel="stylesheet" href="{{ asset(stylesheet) }}"> |
||||
{% endfor %} |
||||
{% endblock %} |
||||
|
||||
</head> |
||||
<body class="hold-transition login-page"> |
||||
|
||||
<div class="login-box"> |
||||
<div class="login-logo"> |
||||
Chamilo |
||||
</div> |
||||
{% block page_content %}{% endblock %} |
||||
</div> |
||||
|
||||
</body> |
||||
</html> |
@ -0,0 +1,13 @@ |
||||
{% macro create(url) %} |
||||
<div class="form-actions"> |
||||
<button type="submit" class="btn btn-primary btn-lg"><i class="icon-ok"></i> {{ 'chamilo.create'|trans }}</button> |
||||
<a href="{{ app.request.headers.get('referer', url) }}" class="btn btn-danger btn-lg"><i class="icon-remove"></i> {{ 'chamilo.cancel'|trans }}</a> |
||||
</div> |
||||
{% endmacro %} |
||||
|
||||
{% macro update(url) %} |
||||
<div class="form-actions"> |
||||
<button type="submit" class="btn btn-primary btn-lg"><i class="icon-save"></i> {{ 'chamilo.save_changes'|trans }}</button> |
||||
<a href="{{ app.request.headers.get('referer', url) }}" class="btn btn-danger btn-lg"><i class="icon-remove"></i> {{ 'chamilo.cancel'|trans }}</a> |
||||
</div> |
||||
{% endmacro %} |
@ -0,0 +1,67 @@ |
||||
{% block box_collapse %} |
||||
<button class="btn btn-{{ type|default('info') }} btn-sm" data-widget="collapse"><i class="fa fa-minus"></i></button> |
||||
{% endblock %} |
||||
{% block box_remove %} |
||||
<button class="btn btn-{{ type|default('info') }} btn-sm" data-widget="remove"><i class="fa fa-times"></i></button> |
||||
{% endblock %} |
||||
|
||||
{% block box_header_buttons %} |
||||
{% if collapse or remove %} |
||||
<div class="box-tools pull-right"> |
||||
{% if collapse %} |
||||
{{ block('box_collapse') }} |
||||
{% endif %} |
||||
{% if remove %} |
||||
{{ block('box_remove') }} |
||||
{% endif %} |
||||
</div> |
||||
{% endif %} |
||||
{% endblock %} |
||||
|
||||
{% macro box_header(title, collapse, remove, type) %} |
||||
<div class="box-header"> |
||||
<h3 class="box-title">{{ title }}</h3> |
||||
{{ block('box_header_buttons') }} |
||||
</div> |
||||
{% endmacro %} |
||||
|
||||
{% macro menu_item(item) %} |
||||
<li id="{{ item.identifier }}" class=" {{ item.isActive ? 'active' : '' }} {{ item.hasChildren? 'treeview' : '' }}"> |
||||
<a href="{{ item.hasChildren ? '#': '/' in item.route ? item.route : path(item.route, item.routeArgs) }}"> |
||||
{% if item.icon %} <i class="{{ item.icon }}"></i> {% endif %} |
||||
<span>{{ item.label }}</span> |
||||
{% if item.badge %} |
||||
<small class="badge pull-right bg-{{ item.badgeColor }}">{{ item.badge }}</small> |
||||
{% endif %} |
||||
</a> |
||||
|
||||
{% if item.hasChildren %} |
||||
<ul class="treeview-menu"> |
||||
{% for child in item.children %} |
||||
<li class="{{ child.isActive ? 'active':'' }}" id="{{ child.identifier }}"> |
||||
<a href="{{ '/' in child.route ? child.route : path(child.route, child.routeArgs) }}"> |
||||
<i class="fa fa-angle-double-right"></i> |
||||
{{ child.label }} |
||||
</a> |
||||
</li> |
||||
{% endfor %} |
||||
</ul> |
||||
{% endif %} |
||||
</li> |
||||
{% endmacro %} |
||||
|
||||
|
||||
{% macro panel(title, content) %} |
||||
{% autoescape false %} |
||||
<div class="panel panel-default"> |
||||
<div class="panel-heading"> |
||||
<div class="panel-title"> |
||||
<h4> {{ title }} </h4> |
||||
</div> |
||||
</div> |
||||
<div class="panel-body"> |
||||
{{ content }} |
||||
</div> |
||||
</div> |
||||
{% endautoescape %} |
||||
{% endmacro %} |
@ -0,0 +1,62 @@ |
||||
{% macro show(url, message) %} |
||||
<a href="{{ url }}" class="btn btn-default"> |
||||
<i class="glyphicon glyphicon-book"></i><span>{{ message is empty ? 'sylius.show'|trans : message }}</span> |
||||
</a> |
||||
{% endmacro %} |
||||
|
||||
{% macro generic(url, message, icon) %} |
||||
<a href="{{ url }}" class="btn btn-default"> |
||||
{% if icon is not empty %}<i class="glyphicon glyphicon-{{ icon }}"></i>{% endif %}<span>{{ message }}</span> |
||||
</a> |
||||
{% endmacro %} |
||||
|
||||
{% macro create(url, message) %} |
||||
<a href="{{ url }}" class="btn btn-primary"> |
||||
<i class="glyphicon glyphicon-plus-sign"></i><span>{{ message is empty ? 'sylius.create'|trans : message }}</span> |
||||
</a> |
||||
{% endmacro %} |
||||
|
||||
{% macro edit(url, message) %} |
||||
<a href="{{ url }}" class="btn btn-primary"> |
||||
<i class="glyphicon glyphicon-pencil"></i><span>{{ message is empty ? 'sylius.edit'|trans : message }}</span> |
||||
</a> |
||||
{% endmacro %} |
||||
|
||||
{% macro delete(url, message, disabled=false, modal=true) %} |
||||
{% if disabled %} |
||||
<span class="btn btn-danger disabled"> |
||||
<i class="glyphicon glyphicon-trash"></i><span>{{ message is empty ? 'sylius.delete'|trans : message }}</span> |
||||
</span> |
||||
{% else %} |
||||
<form action="{{ url }}" method="post" class="delete-action-form" novalidate> |
||||
<input type="hidden" name="_method" value="DELETE"> |
||||
<button class="btn btn-danger{% if modal %} btn-confirm{% endif %}" type="submit"> |
||||
<i class="glyphicon glyphicon-trash"></i> <span>{{ message is empty ? 'sylius.delete'|trans : message }}</span> |
||||
</button> |
||||
</form> |
||||
{% endif %} |
||||
{% endmacro %} |
||||
|
||||
{% macro manage(url, message) %} |
||||
<a href="{{ url }}" class="btn btn-success"> |
||||
<i class="glyphicon glyphicon-folder-open"></i><span>{{ message is empty ? 'sylius.manage'|trans : message }}</span> |
||||
</a> |
||||
{% endmacro %} |
||||
|
||||
{% macro move(url, direction, first=false, last=false, message='') %} |
||||
<form action="{{ url }}" method="post" class="delete-action-form" novalidate> |
||||
<input type="hidden" name="_method" value="PUT"> |
||||
<button title="{{ message is empty ? ('sylius.move_'~direction)|trans : message }}" class="btn btn-default {% if ('up' == direction and first) or ('down' == direction and last) %}disabled{% endif %}" type="submit"> |
||||
<i class="glyphicon glyphicon-arrow-{{ direction }}"></i> |
||||
</button> |
||||
</form> |
||||
{% endmacro %} |
||||
|
||||
{% macro patch(url, message, icon, button) %} |
||||
<form action="{{ url }}" method="post" class="delete-action-form" novalidate> |
||||
<input type="hidden" name="_method" value="PATCH"> |
||||
<button class="btn btn-{{ button|default('success') }}" type="submit"> |
||||
<i class="glyphicon glyphicon-{{ icon|default('transfer') }}"></i> <span>{{ message }}</span> |
||||
</button> |
||||
</form> |
||||
{% endmacro %} |
@ -0,0 +1,7 @@ |
||||
{% macro header(title) %} |
||||
<h3>{{ title }}</h3> |
||||
{% endmacro %} |
||||
|
||||
{% macro sub_header(title) %} |
||||
<h4>{{ title }}</h4> |
||||
{% endmacro %} |
@ -0,0 +1,15 @@ |
||||
{% macro avatar(image, alt, class) %} |
||||
{% if image %} |
||||
<img src="{{ asset(image) }}" class="{{class|default('img-circle')}}" alt="{{ alt }}" /> |
||||
{% else %} |
||||
{#{% image '@avatar_img' %}#} |
||||
{#<img src="{{ asset_url }}" class="{{ class|default('img-circle') }}" alt="{{alt}}" />#} |
||||
{#{% endimage %}#} |
||||
{% endif %} |
||||
{% endmacro %} |
||||
|
||||
{% macro avatar_from_media(media, alt, class) %} |
||||
{% if media %} |
||||
{% thumbnail media, 'small' with {'class': 'img-circle'} %} |
||||
{% endif %} |
||||
{% endmacro %} |
@ -0,0 +1,37 @@ |
||||
{% import "ChamiloThemeBundle:Macros:image.html.twig" as macro_image %} |
||||
<!-- Messages: style can be found in dropdown.less--> |
||||
<li class="dropdown messages-menu"> |
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> |
||||
<i class="fa fa-envelope"></i> |
||||
<span class="label label-success">{{ total }}</span> |
||||
</a> |
||||
<ul class="dropdown-menu"> |
||||
<li class="header"> |
||||
{{ 'You have %total% messages'|trans({'%total%':total}, 'ChamiloThemeBundle') }} |
||||
</li> |
||||
<li> |
||||
<!-- inner menu: contains the actual data --> |
||||
<ul class="menu"> |
||||
{% for msg in messages %} |
||||
<li><!-- start message --> |
||||
<a href="{{ path('fos_message_thread_view', {'messageid': msg.identifier}) }}"> |
||||
<div class="pull-left"> |
||||
{{ macro_image.avatar(msg.from.avatar, msg.from.username) }} |
||||
</div> |
||||
<h4> |
||||
{{ msg.from.username }} |
||||
<small><i class="fa fa-clock-o"></i> {{ msg.sentAt|date('d.m.Y H:i') }}</small> |
||||
</h4> |
||||
<p>{{ msg.subject }}</p> |
||||
</a> |
||||
</li><!-- end message --> |
||||
{% endfor %} |
||||
</ul> |
||||
</li> |
||||
<li class="footer"> |
||||
<a href="{{ path('fos_message_inbox') }}"> |
||||
{{'See All Messages'|trans({}, 'ChamiloThemeBundle')}} |
||||
</a> |
||||
</li> |
||||
</ul> |
||||
</li> |
@ -0,0 +1,24 @@ |
||||
<!-- Notifications: style can be found in dropdown.less --> |
||||
<li class="dropdown notifications-menu"> |
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> |
||||
<i class="fa fa-warning"></i> |
||||
<span class="label label-warning">{{ total }}</span> |
||||
</a> |
||||
<ul class="dropdown-menu"> |
||||
<li class="header">{{ 'You have %total% notifications'|trans({'%total%': total}, 'ChamiloThemeBundle') }}</li> |
||||
<li> |
||||
<!-- inner menu: contains the actual data --> |
||||
<ul class="menu"> |
||||
|
||||
{% for notice in notifications %} |
||||
<li> |
||||
<a href="{{ path('chamilo_admin_show_notification', {'notifyid':notice.identifier}) }}"> |
||||
<i class="{{ notice.icon }} {{ notice.type }}"></i> {{notice.message}} |
||||
</a> |
||||
</li> |
||||
{% endfor %} |
||||
</ul> |
||||
</li> |
||||
<li class="footer"><a href="{{ path('chamilo_admin_all_notifications') }}">{{'View all'|trans({}, 'ChamiloThemeBundle')}}</a></li> |
||||
</ul> |
||||
</li> |
@ -0,0 +1,37 @@ |
||||
<!-- Tasks: style can be found in dropdown.less --> |
||||
<li class="dropdown tasks-menu"> |
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> |
||||
<i class="fa fa-tasks"></i> |
||||
<span class="label label-danger">{{ total }}</span> |
||||
</a> |
||||
<ul class="dropdown-menu"> |
||||
<li class="header">{{ 'You have %total% tasks' |trans({'%total%':total}, 'ChamiloThemeBundle') }}</li> |
||||
<li> |
||||
<!-- inner menu: contains the actual data --> |
||||
<ul class="menu"> |
||||
{% for task in tasks %} |
||||
<li> |
||||
<a href="{{ path('chamilo_admin_show_task', {'taskid': task.identifier}) }}"> |
||||
<h3> |
||||
{{ task.title }} |
||||
<small>{{ task.progress }}%</small> |
||||
</h3> |
||||
<div class="progress xs"> |
||||
<div class="progress-bar progress-bar-{{ task.color }}" |
||||
style="width: {{ task.progress }}%" |
||||
role="progressbar" |
||||
aria-valuenow="{{ task.progress }}" |
||||
aria-valuemin="0" |
||||
aria-valuemax="100"> |
||||
<span class="sr-only">{{ '%progress%% Complete'|trans({'%progress%':task.progress}, 'ChamiloThemeBundle') }}</span> |
||||
</div> |
||||
</div> |
||||
</a> |
||||
</li> |
||||
{% endfor %} |
||||
</ul> |
||||
<li class="footer"> |
||||
<a href="{{ path('chamilo_admin_all_tasks') }}">{{'View all tasks'|trans({}, 'ChamiloThemeBundle')}}</a> |
||||
</li> |
||||
</ul> |
||||
</li> |
@ -0,0 +1,47 @@ |
||||
<!-- User Account: style can be found in dropdown.less --> |
||||
{% import "ChamiloThemeBundle:Macros:image.html.twig" as macro_image %} |
||||
<li class="dropdown user user-menu"> |
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> |
||||
<i class="glyphicon glyphicon-user"></i> |
||||
<span>{{ user.username }} <i class="caret"></i></span> |
||||
</a> |
||||
<ul class="dropdown-menu"> |
||||
<!-- User image --> |
||||
<li class="user-header bg-light-blue"> |
||||
{{ macro_image.avatar(user.avatar, user.username) }} |
||||
<p> |
||||
{{ user.username }} |
||||
<small> |
||||
{{ 'Member since %date%'|trans({'%date%': user.memberSince|date('m.Y') }, 'ChamiloThemeBundle') }} |
||||
</small> |
||||
</p> |
||||
</li> |
||||
<!-- Menu Body --> |
||||
{# |
||||
<li class="user-body"> |
||||
<div class="col-xs-4 text-center"> |
||||
<a href="#">Followers</a> |
||||
</div> |
||||
<div class="col-xs-4 text-center"> |
||||
<a href="#">Sales</a> |
||||
</div> |
||||
<div class="col-xs-4 text-center"> |
||||
<a href="#">Friends</a> |
||||
</div> |
||||
</li> |
||||
#} |
||||
<!-- Menu Footer--> |
||||
<li class="user-footer"> |
||||
<div class="pull-left"> |
||||
<a href="{{ path('chamilo_core_user_user_profile', {'username' : user.identifier}) }}" class="btn btn-default btn-flat"> |
||||
{{'Profile'|trans({}, 'ChamiloThemeBundle')}} |
||||
</a> |
||||
</div> |
||||
<div class="pull-right"> |
||||
<a href="{{ path('logout') }}" class="btn btn-default btn-flat"> |
||||
{{ 'Sign out'|trans({}, 'ChamiloThemeBundle') }} |
||||
</a> |
||||
</div> |
||||
</li> |
||||
</ul> |
||||
</li> |
@ -0,0 +1,62 @@ |
||||
<!DOCTYPE html> |
||||
<html class="bg-black"> |
||||
<head> |
||||
<meta charset="UTF-8"> |
||||
<title>{% block title %} Log in {% endblock %}</title> |
||||
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'> |
||||
|
||||
{#{% stylesheets '@admin_lte_css' %}#} |
||||
{#<link href="{{ asset_url }}" rel="stylesheet" type="text/css" />#} |
||||
{#{% endstylesheets %}#} |
||||
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> |
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// --> |
||||
<!--[if lt IE 9]> |
||||
|
||||
<![endif]--> |
||||
</head> |
||||
<body class="bg-black"> |
||||
|
||||
<div class="form-box" id="login-box"> |
||||
<div class="header">Sign In</div> |
||||
<form action="{{ path('login_check') }}" method="post"> |
||||
<div class="body bg-gray"> |
||||
<div class="form-group"> |
||||
<input type="text" name="_username" class="form-control" placeholder="username" value="{{ last_username }}"/> |
||||
</div> |
||||
<div class="form-group"> |
||||
<input type="password" name="_password" class="form-control" placeholder="Password"/> |
||||
</div> |
||||
{# |
||||
<div class="form-group"> |
||||
<input type="checkbox" name="remember_me"/> Remember me |
||||
</div> |
||||
#} |
||||
</div> |
||||
<div class="footer"> |
||||
<button type="submit" class="btn bg-olive btn-block">Sign me in</button> |
||||
|
||||
<p><a href="#">I forgot my password</a></p> |
||||
|
||||
<a href="register.html" class="text-center">Register a new membership</a> |
||||
</div> |
||||
</form> |
||||
|
||||
<div class="margin text-center"> |
||||
<span>Sign in using social networks</span> |
||||
<br/> |
||||
<button class="btn bg-light-blue btn-circle"><i class="fa fa-facebook"></i></button> |
||||
<button class="btn bg-aqua btn-circle"><i class="fa fa-twitter"></i></button> |
||||
<button class="btn bg-red btn-circle"><i class="fa fa-google-plus"></i></button> |
||||
|
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
<!-- jQuery 2.0.2 --> |
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script> |
||||
<!-- Bootstrap --> |
||||
<script src="../../js/bootstrap.min.js" type="text/javascript"></script> |
||||
|
||||
</body> |
||||
</html> |
@ -0,0 +1,38 @@ |
||||
<!-- sidebar menu: : style can be found in sidebar.less --> |
||||
{% import "ChamiloThemeBundle:Macros:box.html.twig" as macro %} |
||||
{% autoescape false %} |
||||
|
||||
{% if is_granted('IS_AUTHENTICATED_FULLY') %} |
||||
{#{{ macro.panel(#} |
||||
{#'Profile' | trans,#} |
||||
{#mopa_bootstrap_menu('ChamiloCoreBundle:SimpleMenuBuilder:mainMenu', {'automenu': 'pills', 'stacked':true})) }}#} |
||||
|
||||
{{ macro.panel( |
||||
'Courses' | trans, |
||||
mopa_bootstrap_menu('ChamiloCoreBundle:CourseMenuBuilder:courseMenu', {'automenu': 'pills', 'stacked':true})) }} |
||||
|
||||
{{ macro.panel( |
||||
'Skills' | trans, |
||||
mopa_bootstrap_menu('ChamiloCoreBundle:CourseMenuBuilder:skillsMenu', {'automenu': 'pills', 'stacked':true})) }} |
||||
|
||||
{% else %} |
||||
{{ locale_switcher(null, null, 'ChamiloCoreBundle:Admin:switcher_links.html.twig') }} |
||||
<div class="user-panel"> |
||||
|
||||
</div> |
||||
<form action="{{ path("fos_user_security_check") }}" method="post" role="form" class="sidebar-form"> |
||||
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}"/> |
||||
<div class="form-group"> |
||||
<label for="username">{{ 'security.login.username' | trans({}, 'FOSUserBundle') }}</label> |
||||
<input type="text" class="form-control" id="username" name="_username" > |
||||
</div> |
||||
<div class="form-group"> |
||||
<label for="password">{{ 'security.login.password' | trans({}, 'FOSUserBundle') }}</label> |
||||
<input type="password" class="form-control" id="password" name="_password"> |
||||
</div> |
||||
<button type="submit" class="btn btn-default">{{ 'security.login.submit' | trans({}, 'FOSUserBundle') }}</button> |
||||
</form> |
||||
{{ mopa_bootstrap_menu('ChamiloCoreBundle:SimpleMenuBuilder:notLoginMenu', {'automenu': 'pills', 'stacked':true}) }} |
||||
{% endif %} |
||||
|
||||
{% endautoescape %} |
@ -0,0 +1,12 @@ |
||||
<!-- search form --> |
||||
<form action="#" method="get" class="sidebar-form"> |
||||
<div class="input-group"> |
||||
<input type="text" name="q" class="form-control" placeholder="Search..."/> |
||||
<span class="input-group-btn"> |
||||
<button type='submit' name='seach' id='search-btn' class="btn btn-flat"> |
||||
<i class="fa fa-search"></i> |
||||
</button> |
||||
</span> |
||||
</div> |
||||
</form> |
||||
<!-- /.search form --> |
@ -0,0 +1,24 @@ |
||||
{% import "ChamiloThemeBundle:Macros:image.html.twig" as macro_image %} |
||||
<!-- Sidebar user panel --> |
||||
<div class="user-panel"> |
||||
<div class="pull-left image"> |
||||
{% if user.avatar %} |
||||
{{ macro_image.avatar_from_media(user.avatar, user.username) }} |
||||
{% else %} |
||||
{{ macro_image.avatar('bundles/chamilocore/img/unknown.jpg', user.username) }} |
||||
{% endif %} |
||||
</div> |
||||
|
||||
<div class="pull-left info"> |
||||
<p>{{ 'Hello, %user%'| trans( {'%user%': user.username }, 'ChamiloThemeBundle') }}</p> |
||||
<a href="#"> |
||||
<i class="fa fa-circle text-success"></i> {{ 'Online' | trans }} |
||||
</a> |
||||
</div> |
||||
|
||||
{% if is_granted('ROLE_PREVIOUS_ADMIN') %} |
||||
<a href="{{ path('home', {'_switch_user': '_exit'}) }}"> |
||||
{{ 'Exit impersonation' | trans }} |
||||
</a> |
||||
{% endif %} |
||||
</div> |
@ -0,0 +1,39 @@ |
||||
<?php |
||||
/** |
||||
* MenuLoader.php |
||||
* avanzu-admin |
||||
* Date: 24.02.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Routing; |
||||
|
||||
|
||||
use Symfony\Component\Config\Loader\Loader; |
||||
use Symfony\Component\Config\Loader\LoaderResolverInterface; |
||||
|
||||
class MenuLoader extends Loader { |
||||
|
||||
/** |
||||
* Loads a resource. |
||||
* |
||||
* @param mixed $resource The resource |
||||
* @param string $type The resource type |
||||
*/ |
||||
public function load($resource, $type = null) |
||||
{ |
||||
} |
||||
|
||||
/** |
||||
* Returns true if this class supports the given resource. |
||||
* |
||||
* @param mixed $resource A resource |
||||
* @param string $type The resource type |
||||
* |
||||
* @return Boolean true if this class supports the given resource, false otherwise |
||||
*/ |
||||
public function supports($resource, $type = null) |
||||
{ |
||||
return true; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,104 @@ |
||||
<?php |
||||
/** |
||||
* ThemeManager.php |
||||
* publisher |
||||
* Date: 18.04.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Theme; |
||||
|
||||
|
||||
use Assetic\Asset\AssetCollection; |
||||
use Assetic\Asset\AssetReference; |
||||
use Assetic\Factory\AssetFactory; |
||||
use Assetic\Factory\LazyAssetManager; |
||||
use Assetic\Factory\Resource\FileResource; |
||||
use Chamilo\FoundationBundle\Util\DependencyResolverInterface; |
||||
use Symfony\Bundle\AsseticBundle\Config\AsseticResource; |
||||
use Symfony\Component\DependencyInjection\Container; |
||||
use Chamilo\FoundationBundle\Util\DependencyResolver; |
||||
use Symfony\Component\HttpKernel\Config\FileLocator; |
||||
|
||||
class ThemeManager |
||||
{ |
||||
|
||||
/** @var Container */ |
||||
protected $container; |
||||
|
||||
protected $stylesheets = array(); |
||||
|
||||
protected $javascripts = array(); |
||||
|
||||
protected $locations = array(); |
||||
|
||||
protected $resolverClass; |
||||
|
||||
function __construct($container, $resolverClass = null) |
||||
{ |
||||
$this->container = $container; |
||||
$this->resolverClass = $resolverClass?: 'Chamilo\ThemeBundle\Util\DependencyResolver'; |
||||
} |
||||
|
||||
public function registerScript($id, $src, $deps = array(), $location = "bottom") |
||||
{ |
||||
|
||||
if (!isset($this->javascripts[$id])) { |
||||
$this->javascripts[$id] = array( |
||||
'src' => $src, |
||||
'deps' => $deps, |
||||
'location' => $location |
||||
); |
||||
} |
||||
|
||||
} |
||||
|
||||
public function registerStyle($id, $src, $deps = array()) { |
||||
if(!isset($this->stylesheets[$id])) { |
||||
$this->stylesheets[$id] = array( |
||||
'src' => $src, |
||||
'deps' => $deps, |
||||
); |
||||
} |
||||
} |
||||
|
||||
public function getScripts($location = 'bottom') { |
||||
|
||||
$unsorted = array(); $srcList = array(); $assetList = array(); |
||||
foreach($this->javascripts as $id => $scriptDefinition) { |
||||
if($scriptDefinition['location'] == $location) { |
||||
$unsorted[$id] = $scriptDefinition; |
||||
} |
||||
} |
||||
|
||||
$queue = $this->getResolver()->register($unsorted)->resolveAll(); |
||||
foreach($queue as $def){ |
||||
$srcList[] = $def['src']; |
||||
} |
||||
return $srcList; |
||||
} |
||||
|
||||
public function getStyles() { |
||||
$srcList = array(); |
||||
$queue = $this->getResolver()->register($this->stylesheets)->resolveAll(); |
||||
foreach($queue as $def){ |
||||
$srcList[] = $def['src']; |
||||
} |
||||
return $srcList; |
||||
} |
||||
|
||||
/** |
||||
* @return DependencyResolverInterface |
||||
*/ |
||||
protected function getResolver() { |
||||
$class = $this->resolverClass; |
||||
return new $class; |
||||
} |
||||
|
||||
/** |
||||
* @return FileLocator |
||||
*/ |
||||
protected function getLocator() { |
||||
return $this->container->get('file_locator'); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,45 @@ |
||||
<?php |
||||
/** |
||||
* WidgetExtension.php |
||||
* avanzu-admin |
||||
* Date: 17.03.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Twig; |
||||
|
||||
|
||||
use Twig_Environment; |
||||
|
||||
class WidgetExtension extends \Twig_Extension { |
||||
|
||||
/** |
||||
* @var Twig_Environment |
||||
*/ |
||||
protected $env; |
||||
|
||||
public function renderWidget() { |
||||
|
||||
} |
||||
|
||||
public function getFunctions() |
||||
{ |
||||
return array( |
||||
'widget_box' => new \Twig_SimpleFunction( |
||||
'widget_box', |
||||
array($this, 'renderWidget'), |
||||
array('is_safe' => array('html')) |
||||
), |
||||
); |
||||
} |
||||
|
||||
public function initRuntime(Twig_Environment $environment) |
||||
{ |
||||
$this->env = $environment; |
||||
} |
||||
|
||||
|
||||
public function getName() |
||||
{ |
||||
return 'chamilo_widget'; |
||||
} |
||||
} |
@ -0,0 +1,180 @@ |
||||
<?php |
||||
/** |
||||
* DependencyResolver.php |
||||
* publisher |
||||
* Date: 18.04.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Util; |
||||
|
||||
|
||||
/** |
||||
* Class DependencyResolver |
||||
* |
||||
* @package Chamilo\ThemeBundle\Util |
||||
*/ |
||||
class DependencyResolver implements DependencyResolverInterface |
||||
{ |
||||
|
||||
/** |
||||
* @var array |
||||
*/ |
||||
protected $queued = array(); |
||||
/** |
||||
* @var array |
||||
*/ |
||||
protected $registered = array(); |
||||
/** |
||||
* @var array |
||||
*/ |
||||
protected $resolved = array(); |
||||
/** |
||||
* @var array |
||||
*/ |
||||
protected $unresolved = array(); |
||||
|
||||
|
||||
/** |
||||
* @param $items |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function register($items) |
||||
{ |
||||
$this->registered = $items; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return array |
||||
*/ |
||||
public function resolveAll() |
||||
{ |
||||
$this->failOnCircularDependencies(); |
||||
$this->resolve(array_keys($this->registered)); |
||||
|
||||
return $this->queued; |
||||
} |
||||
|
||||
/** |
||||
* @param $ids |
||||
*/ |
||||
protected function resolve($ids) |
||||
{ |
||||
foreach ($ids as $id) { |
||||
if (isset($this->resolved[$id])) { |
||||
continue; |
||||
} // already done |
||||
if (!isset($this->registered[$id])) { |
||||
continue; |
||||
} // unregistered |
||||
if (!$this->hasDependencies($id)) { // standalone |
||||
$this->queued[] = $this->registered[$id]; |
||||
$this->resolved[$id] = true; |
||||
|
||||
continue; |
||||
} |
||||
|
||||
$deps = $this->unresolved($this->getDependencies($id)); |
||||
|
||||
$this->resolve($deps); |
||||
|
||||
$deps = $this->unresolved($this->getDependencies($id)); |
||||
|
||||
if (empty($deps)) { |
||||
$this->queued[] = $this->registered[$id]; |
||||
$this->resolved[$id] = true; |
||||
|
||||
continue; |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
/** |
||||
* @param $deps |
||||
* |
||||
* @return array |
||||
*/ |
||||
protected function unresolved($deps) |
||||
{ |
||||
return array_diff($deps, array_keys($this->resolved)); |
||||
} |
||||
|
||||
/** |
||||
* @param $id |
||||
* |
||||
* @return bool |
||||
*/ |
||||
protected function hasDependencies($id) |
||||
{ |
||||
if (!isset($this->registered[$id])) { |
||||
return false; |
||||
} |
||||
|
||||
return (!empty($this->registered[$id]['deps'])); |
||||
} |
||||
|
||||
/** |
||||
* @param $id |
||||
* |
||||
* @return null |
||||
*/ |
||||
protected function getDependencies($id) |
||||
{ |
||||
if (!$this->hasDependencies($id)) { |
||||
return null; |
||||
} |
||||
|
||||
return $this->registered[$id]['deps']; |
||||
} |
||||
|
||||
/** |
||||
* @param $needle |
||||
* @param $haystackId |
||||
* |
||||
* @return bool |
||||
*/ |
||||
protected function contains($needle, $haystackId) |
||||
{ |
||||
$deps = $this->getDependencies($haystackId); |
||||
if (!is_array($deps)) { |
||||
return false; |
||||
} |
||||
|
||||
return in_array($needle, $deps); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* @throws \RuntimeException |
||||
*/ |
||||
protected function failOnCircularDependencies() |
||||
{ |
||||
$ids = array_keys($this->registered); |
||||
|
||||
foreach ($ids as $id) { |
||||
|
||||
if (!$this->hasDependencies($id)) { |
||||
continue; |
||||
} |
||||
|
||||
$dependencies = $this->getDependencies($id); |
||||
|
||||
foreach ($dependencies as $dep) { |
||||
if ($this->contains($id, $dep)) { |
||||
throw new \RuntimeException( |
||||
sprintf( |
||||
'Circular dependency [%s] depends on [%s] which itself depends on [%s]', |
||||
$id, $dep, $id |
||||
) |
||||
); |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,24 @@ |
||||
<?php |
||||
/** |
||||
* DependencyResolverInterface.php |
||||
* publisher |
||||
* Date: 18.04.14 |
||||
*/ |
||||
|
||||
namespace Chamilo\ThemeBundle\Util; |
||||
|
||||
|
||||
interface DependencyResolverInterface |
||||
{ |
||||
/** |
||||
* @param $items |
||||
* |
||||
* @return $this |
||||
*/ |
||||
public function register($items); |
||||
|
||||
/** |
||||
* @return array |
||||
*/ |
||||
public function resolveAll(); |
||||
} |
Loading…
Reference in new issue