parent
c22b6ae18e
commit
c3e552225b
@ -1,59 +0,0 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Admin; |
||||
|
||||
use FOS\CKEditorBundle\Form\Type\CKEditorType; |
||||
use Sonata\AdminBundle\Admin\AbstractAdmin; |
||||
use Sonata\AdminBundle\Datagrid\DatagridMapper; |
||||
use Sonata\AdminBundle\Datagrid\ListMapper; |
||||
use Sonata\AdminBundle\Form\FormMapper; |
||||
use Symfony\Component\Form\Extension\Core\Type\EmailType; |
||||
use Symfony\Component\Form\Extension\Core\Type\UrlType; |
||||
|
||||
/** |
||||
* Class AccessUrlAdmin. |
||||
*/ |
||||
class AccessUrlAdmin extends AbstractAdmin |
||||
{ |
||||
/** |
||||
* @param $course |
||||
* |
||||
* @return mixed|void |
||||
*/ |
||||
public function preUpdate($course) |
||||
{ |
||||
//$course->setUsers($course->getUsers()); |
||||
} |
||||
|
||||
protected function configureFormFields(FormMapper $formMapper) |
||||
{ |
||||
$formMapper |
||||
->add('url', UrlType::class) |
||||
->add('description', CKEditorType::class) |
||||
->add('active') |
||||
->add('limitCourses') |
||||
->add('limitActiveCourses') |
||||
->add('limitSessions') |
||||
->add('limitUsers') |
||||
->add('limitTeachers') |
||||
->add('limitDiskSpace') |
||||
->add('email', EmailType::class) |
||||
; |
||||
} |
||||
|
||||
protected function configureDatagridFilters(DatagridMapper $datagridMapper) |
||||
{ |
||||
$datagridMapper |
||||
->add('url') |
||||
; |
||||
} |
||||
|
||||
protected function configureListFields(ListMapper $listMapper) |
||||
{ |
||||
$listMapper |
||||
->addIdentifier('url') |
||||
; |
||||
} |
||||
} |
@ -1,46 +0,0 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Admin; |
||||
|
||||
use Sonata\AdminBundle\Admin\AbstractAdmin; |
||||
use Sonata\AdminBundle\Datagrid\DatagridMapper; |
||||
use Sonata\AdminBundle\Datagrid\ListMapper; |
||||
use Sonata\AdminBundle\Form\FormMapper; |
||||
use Sonata\AdminBundle\Show\ShowMapper; |
||||
|
||||
/** |
||||
* Class CourseAdmin. |
||||
*/ |
||||
class AccessUrlRelCourseAdmin extends AbstractAdmin |
||||
{ |
||||
protected function configureShowField(ShowMapper $showMapper) |
||||
{ |
||||
$showMapper |
||||
->add('id') |
||||
; |
||||
} |
||||
|
||||
protected function configureFormFields(FormMapper $formMapper) |
||||
{ |
||||
$formMapper |
||||
->add('url') |
||||
->end() |
||||
; |
||||
} |
||||
|
||||
protected function configureDatagridFilters(DatagridMapper $datagridMapper) |
||||
{ |
||||
$datagridMapper |
||||
->add('url') |
||||
; |
||||
} |
||||
|
||||
protected function configureListFields(ListMapper $listMapper) |
||||
{ |
||||
$listMapper |
||||
->addIdentifier('url') |
||||
; |
||||
} |
||||
} |
@ -1,40 +0,0 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Admin; |
||||
|
||||
use Sonata\AdminBundle\Admin\AbstractAdmin; |
||||
use Sonata\AdminBundle\Datagrid\DatagridMapper; |
||||
use Sonata\AdminBundle\Datagrid\ListMapper; |
||||
use Sonata\AdminBundle\Form\FormMapper; |
||||
|
||||
/** |
||||
* Class BranchAdmin. |
||||
*/ |
||||
class BranchAdmin extends AbstractAdmin |
||||
{ |
||||
// Fields to be shown on create/edit forms |
||||
protected function configureFormFields(FormMapper $formMapper) |
||||
{ |
||||
$formMapper |
||||
->add('id') |
||||
; |
||||
} |
||||
|
||||
// Fields to be shown on filter forms |
||||
protected function configureDatagridFilters(DatagridMapper $datagridMapper) |
||||
{ |
||||
$datagridMapper |
||||
->add('id') |
||||
; |
||||
} |
||||
|
||||
// Fields to be shown on lists |
||||
protected function configureListFields(ListMapper $listMapper) |
||||
{ |
||||
$listMapper |
||||
->addIdentifier('id') |
||||
; |
||||
} |
||||
} |
@ -1,42 +0,0 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Admin; |
||||
|
||||
use Chamilo\CoreBundle\Entity\Career; |
||||
use FOS\CKEditorBundle\Form\Type\CKEditorType; |
||||
use Sonata\AdminBundle\Admin\AbstractAdmin; |
||||
use Sonata\AdminBundle\Datagrid\DatagridMapper; |
||||
use Sonata\AdminBundle\Datagrid\ListMapper; |
||||
use Sonata\AdminBundle\Form\FormMapper; |
||||
|
||||
/** |
||||
* Class CareerAdmin. |
||||
*/ |
||||
class CareerAdmin extends AbstractAdmin |
||||
{ |
||||
protected function configureFormFields(FormMapper $formMapper) |
||||
{ |
||||
$formMapper |
||||
->add('name') |
||||
->add('description', CKEditorType::class) |
||||
//->add('status', 'choice', ['choices' => Career::getStatusList()]) |
||||
; |
||||
} |
||||
|
||||
protected function configureDatagridFilters(DatagridMapper $datagridMapper) |
||||
{ |
||||
$datagridMapper |
||||
->add('name') |
||||
; |
||||
} |
||||
|
||||
protected function configureListFields(ListMapper $listMapper) |
||||
{ |
||||
$listMapper |
||||
->addIdentifier('id') |
||||
->addIdentifier('name') |
||||
; |
||||
} |
||||
} |
@ -1,43 +0,0 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Admin; |
||||
|
||||
use Chamilo\CoreBundle\Entity\Promotion; |
||||
use FOS\CKEditorBundle\Form\Type\CKEditorType; |
||||
use Sonata\AdminBundle\Admin\AbstractAdmin; |
||||
use Sonata\AdminBundle\Datagrid\DatagridMapper; |
||||
use Sonata\AdminBundle\Datagrid\ListMapper; |
||||
use Sonata\AdminBundle\Form\FormMapper; |
||||
|
||||
/** |
||||
* Class PromotionAdmin. |
||||
*/ |
||||
class PromotionAdmin extends AbstractAdmin |
||||
{ |
||||
protected function configureFormFields(FormMapper $formMapper) |
||||
{ |
||||
$formMapper |
||||
->add('name') |
||||
->add('description', CKEditorType::class) |
||||
//->add('status', 'choice', ['choices' => Promotion::getStatusList()]) |
||||
->add('career') |
||||
; |
||||
} |
||||
|
||||
protected function configureDatagridFilters(DatagridMapper $datagridMapper) |
||||
{ |
||||
$datagridMapper |
||||
->add('name') |
||||
; |
||||
} |
||||
|
||||
protected function configureListFields(ListMapper $listMapper) |
||||
{ |
||||
$listMapper |
||||
->addIdentifier('id') |
||||
->addIdentifier('name') |
||||
; |
||||
} |
||||
} |
@ -1,73 +0,0 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Admin; |
||||
|
||||
use Chamilo\CoreBundle\Entity\ResourceFile; |
||||
use Sonata\AdminBundle\Admin\AbstractAdmin; |
||||
use Sonata\AdminBundle\Datagrid\DatagridMapper; |
||||
use Sonata\AdminBundle\Datagrid\ListMapper; |
||||
use Sonata\AdminBundle\Form\FormMapper; |
||||
use Sonata\AdminBundle\Show\ShowMapper; |
||||
use Vich\UploaderBundle\Form\Type\VichImageType; |
||||
|
||||
/** |
||||
* Class ResourceFileAdmin. |
||||
*/ |
||||
class ResourceFileAdmin extends AbstractAdmin |
||||
{ |
||||
protected function configureShowField(ShowMapper $showMapper) |
||||
{ |
||||
$showMapper |
||||
->add('id') |
||||
->add('name') |
||||
->add('size') |
||||
; |
||||
} |
||||
|
||||
protected function configureFormFields(FormMapper $formMapper) |
||||
{ |
||||
$router = $this->getRouteGenerator(); |
||||
|
||||
$fileOptions = [ |
||||
'required' => true, |
||||
'allow_delete' => false, |
||||
'download_uri' => static function (ResourceFile $file) use ($router) { |
||||
$resourceNode = $file->getResourceNode(); |
||||
$params = [ |
||||
'tool' => $resourceNode->getResourceType()->getTool(), |
||||
'type' => $resourceNode->getResourceType(), |
||||
'id' => $resourceNode->getId(), |
||||
'mode' => 'download', |
||||
]; |
||||
|
||||
return $router->generate('chamilo_core_resource_view_file', $params); |
||||
}, |
||||
]; |
||||
$formMapper |
||||
->add('file', VichImageType::class, $fileOptions) |
||||
->end() |
||||
; |
||||
} |
||||
|
||||
protected function configureDatagridFilters(DatagridMapper $datagridMapper) |
||||
{ |
||||
$datagridMapper |
||||
->add('id') |
||||
->add('name') |
||||
->add('mimeType') |
||||
; |
||||
} |
||||
|
||||
protected function configureListFields(ListMapper $listMapper) |
||||
{ |
||||
$listMapper |
||||
->addIdentifier('id') |
||||
->addIdentifier('name') |
||||
->add('size') |
||||
->add('mimeType') |
||||
|
||||
; |
||||
} |
||||
} |
@ -1,64 +0,0 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Admin; |
||||
|
||||
use Chamilo\CoreBundle\Entity\ResourceLink; |
||||
use Sonata\AdminBundle\Admin\AbstractAdmin; |
||||
use Sonata\AdminBundle\Datagrid\DatagridMapper; |
||||
use Sonata\AdminBundle\Datagrid\ListMapper; |
||||
use Sonata\AdminBundle\Form\FormMapper; |
||||
use Sonata\AdminBundle\Form\Type\ModelAutocompleteType; |
||||
use Sonata\AdminBundle\Form\Type\ModelType; |
||||
use Sonata\AdminBundle\Show\ShowMapper; |
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; |
||||
|
||||
/** |
||||
* Class ResourceLinkAdmin. |
||||
*/ |
||||
class ResourceLinkAdmin extends AbstractAdmin |
||||
{ |
||||
protected function configureShowField(ShowMapper $showMapper) |
||||
{ |
||||
$showMapper |
||||
->add('id') |
||||
->add('resourceNode') |
||||
; |
||||
} |
||||
|
||||
protected function configureFormFields(FormMapper $formMapper) |
||||
{ |
||||
$formMapper |
||||
->add('resourceNode') |
||||
->add('visibility', ChoiceType::class, ['choices' => ResourceLink::getVisibilityList()]) |
||||
->add( |
||||
'resourceRight', |
||||
ModelAutocompleteType::class, |
||||
['property' => 'id', 'btn_add' => 'link_add', 'multiple' => true] |
||||
) |
||||
//->add('resourceNode', ModelType::class, ['property' => 'id', 'btn_add' => 'link_add']) |
||||
->end() |
||||
; |
||||
} |
||||
|
||||
// /** |
||||
// * @param DatagridMapper $listMapper |
||||
// */ |
||||
// protected function configureDatagridFilters(DatagridMapper $datagridMapper) |
||||
// { |
||||
// $datagridMapper |
||||
// ->add('url') |
||||
// ; |
||||
// } |
||||
// |
||||
|
||||
protected function configureListFields(ListMapper $listMapper) |
||||
{ |
||||
$listMapper |
||||
->addIdentifier('id') |
||||
->addIdentifier('resourceNode') |
||||
->addIdentifier('visibility') |
||||
; |
||||
} |
||||
} |
@ -1,63 +0,0 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Admin; |
||||
|
||||
use Sonata\AdminBundle\Admin\AbstractAdmin; |
||||
use Sonata\AdminBundle\Datagrid\DatagridMapper; |
||||
use Sonata\AdminBundle\Datagrid\ListMapper; |
||||
use Sonata\AdminBundle\Form\FormMapper; |
||||
use Sonata\AdminBundle\Form\Type\ModelAutocompleteType; |
||||
use Sonata\AdminBundle\Form\Type\ModelType; |
||||
use Sonata\AdminBundle\Show\ShowMapper; |
||||
|
||||
/** |
||||
* Class ResourceNodeAdmin. |
||||
*/ |
||||
class ResourceNodeAdmin extends AbstractAdmin |
||||
{ |
||||
protected function configureShowField(ShowMapper $showMapper) |
||||
{ |
||||
$showMapper |
||||
->add('id') |
||||
->add('slug') |
||||
->add('path') |
||||
; |
||||
} |
||||
|
||||
protected function configureFormFields(FormMapper $formMapper) |
||||
{ |
||||
$formMapper |
||||
->add('slug') |
||||
->add('resourceType', ModelType::class, ['property' => 'name', 'btn_add' => false]) |
||||
->add('creator', ModelAutocompleteType::class, ['property' => 'username']) |
||||
->add('resourceFile', ModelType::class, ['property' => 'name', 'btn_add' => 'link_add']) |
||||
->add( |
||||
'resourceLinks', |
||||
ModelAutocompleteType::class, |
||||
['property' => 'id', 'multiple' => true] |
||||
) |
||||
->end() |
||||
; |
||||
} |
||||
|
||||
protected function configureDatagridFilters(DatagridMapper $datagridMapper) |
||||
{ |
||||
$datagridMapper |
||||
->add('resourceType') |
||||
->add('creator') |
||||
; |
||||
} |
||||
|
||||
protected function configureListFields(ListMapper $listMapper) |
||||
{ |
||||
$listMapper |
||||
->addIdentifier('id') |
||||
->addIdentifier('slug') |
||||
->add('resourceType') |
||||
->add('resourceFile') |
||||
->add('creator') |
||||
; |
||||
} |
||||
} |
@ -1,57 +0,0 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Admin; |
||||
|
||||
use Sonata\AdminBundle\Admin\AbstractAdmin; |
||||
use Sonata\AdminBundle\Datagrid\DatagridMapper; |
||||
use Sonata\AdminBundle\Datagrid\ListMapper; |
||||
use Sonata\AdminBundle\Form\FormMapper; |
||||
use Sonata\AdminBundle\Form\Type\ModelType; |
||||
use Sonata\AdminBundle\Show\ShowMapper; |
||||
|
||||
/** |
||||
* Class ResourceRightAdmin. |
||||
*/ |
||||
class ResourceRightAdmin extends AbstractAdmin |
||||
{ |
||||
protected function configureShowField(ShowMapper $showMapper) |
||||
{ |
||||
$showMapper |
||||
->add('id') |
||||
->add('role') |
||||
->add('mask') |
||||
; |
||||
} |
||||
|
||||
protected function configureFormFields(FormMapper $formMapper) |
||||
{ |
||||
$formMapper |
||||
->add('role') |
||||
->add('mask') |
||||
->add('resourceLink', ModelType::class, ['property' => 'id', 'btn_add' => 'link_add']) |
||||
->end() |
||||
; |
||||
} |
||||
|
||||
// /** |
||||
// * @param DatagridMapper $listMapper |
||||
// */ |
||||
// protected function configureDatagridFilters(DatagridMapper $datagridMapper) |
||||
// { |
||||
// $datagridMapper |
||||
// ->add('url') |
||||
// ; |
||||
// } |
||||
// |
||||
|
||||
protected function configureListFields(ListMapper $listMapper) |
||||
{ |
||||
$listMapper |
||||
->addIdentifier('id') |
||||
->addIdentifier('role') |
||||
->addIdentifier('mask') |
||||
; |
||||
} |
||||
} |
@ -1,41 +0,0 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Admin; |
||||
|
||||
use Sonata\AdminBundle\Admin\AbstractAdmin; |
||||
use Sonata\AdminBundle\Datagrid\ListMapper; |
||||
use Sonata\AdminBundle\Form\FormMapper; |
||||
use Sonata\AdminBundle\Show\ShowMapper; |
||||
|
||||
/** |
||||
* Class ResourceTypeAdmin. |
||||
*/ |
||||
class ResourceTypeAdmin extends AbstractAdmin |
||||
{ |
||||
protected function configureShowField(ShowMapper $showMapper) |
||||
{ |
||||
$showMapper |
||||
->add('tool') |
||||
->add('name') |
||||
; |
||||
} |
||||
|
||||
protected function configureFormFields(FormMapper $formMapper) |
||||
{ |
||||
$formMapper |
||||
->add('tool') |
||||
->add('name') |
||||
->end() |
||||
; |
||||
} |
||||
|
||||
protected function configureListFields(ListMapper $listMapper) |
||||
{ |
||||
$listMapper |
||||
->addIdentifier('name') |
||||
->add('tool') |
||||
; |
||||
} |
||||
} |
@ -1,106 +0,0 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Admin; |
||||
|
||||
use Chamilo\CoreBundle\Entity\Session; |
||||
use Sonata\AdminBundle\Admin\AbstractAdmin; |
||||
use Sonata\AdminBundle\Datagrid\DatagridMapper; |
||||
use Sonata\AdminBundle\Datagrid\ListMapper; |
||||
use Sonata\AdminBundle\Form\FormMapper; |
||||
use Sonata\AdminBundle\Show\ShowMapper; |
||||
|
||||
/** |
||||
* Class SessionAdmin. |
||||
*/ |
||||
class SessionAdmin extends AbstractAdmin |
||||
{ |
||||
/** |
||||
* Very important in order to save the related entities! |
||||
* |
||||
* @param Session $session |
||||
* |
||||
* @return mixed|void |
||||
*/ |
||||
public function preUpdate($session) |
||||
{ |
||||
$session->setCourses($session->getCourses()); |
||||
} |
||||
|
||||
protected function configureFormFields(FormMapper $formMapper) |
||||
{ |
||||
$formMapper |
||||
->add('name') //if no type is specified, SonataAdminBundle tries to guess it |
||||
->add('generalCoach') |
||||
->add('category') |
||||
->add('displayStartDate', 'sonata_type_datetime_picker') |
||||
->add( |
||||
'visibility', |
||||
'choice', |
||||
['choices' => Session::getStatusList()] |
||||
) |
||||
->add( |
||||
'courses', |
||||
'sonata_type_collection', |
||||
[ |
||||
'cascade_validation' => true, |
||||
], |
||||
[ |
||||
'edit' => 'inline', |
||||
'inline' => 'table', |
||||
//'sortable' => 'position', |
||||
//'link_parameters' => array('context' => $context), |
||||
'admin_code' => 'sonata.admin.session_rel_course', |
||||
] |
||||
) |
||||
/*->add('users', 'sonata_type_collection', array( |
||||
'cascade_validation' => true, |
||||
), array( |
||||
'allow_delete' => true, |
||||
'by_reference' => false, |
||||
//'edit' => 'inline', |
||||
|
||||
//'sortable' => 'position', |
||||
//'link_parameters' => array('context' => $context), |
||||
//'admin_code' => 'sonata.admin.session_rel_user' |
||||
) |
||||
)*/ |
||||
; |
||||
} |
||||
|
||||
protected function configureShowField(ShowMapper $showMapper) |
||||
{ |
||||
$showMapper |
||||
->add('id', 'text', ['label' => 'Session']) |
||||
->add('name') |
||||
->add('display_start_date', 'sonata_type_date_picker') |
||||
; |
||||
} |
||||
|
||||
protected function configureDatagridFilters(DatagridMapper $datagridMapper) |
||||
{ |
||||
$datagridMapper |
||||
->add('name') |
||||
->add( |
||||
'visibility', |
||||
null, |
||||
[], |
||||
'choice', |
||||
['choices' => Session::getStatusList()] |
||||
) |
||||
//->add('display_start_date', 'sonata_type_date_picker') |
||||
; |
||||
} |
||||
|
||||
protected function configureListFields(ListMapper $listMapper) |
||||
{ |
||||
$listMapper |
||||
->addIdentifier('name') |
||||
->add('generalCoach') |
||||
->add('visibility', 'choice', [ |
||||
'choices' => Session::getStatusList(), |
||||
]) |
||||
; |
||||
} |
||||
} |
@ -1,50 +0,0 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Admin; |
||||
|
||||
use Sonata\AdminBundle\Admin\AbstractAdmin; |
||||
use Sonata\AdminBundle\Datagrid\DatagridMapper; |
||||
use Sonata\AdminBundle\Datagrid\ListMapper; |
||||
use Sonata\AdminBundle\Form\FormMapper; |
||||
use Sonata\AdminBundle\Show\ShowMapper; |
||||
use Symfony\Component\Form\Extension\Core\Type\UrlType; |
||||
|
||||
/** |
||||
* Class CourseRequestAdmin. |
||||
*/ |
||||
class SessionCategoryAdmin extends AbstractAdmin |
||||
{ |
||||
protected function configureFormFields(FormMapper $formMapper) |
||||
{ |
||||
$formMapper |
||||
->add('name') |
||||
->add('url', UrlType::class) |
||||
->add('dateStart', 'sonata_type_datetime_picker') |
||||
->add('dateEnd', 'sonata_type_datetime_picker') |
||||
; |
||||
} |
||||
|
||||
protected function configureShowField(ShowMapper $showMapper) |
||||
{ |
||||
$showMapper |
||||
->add('id') |
||||
->add('name') |
||||
; |
||||
} |
||||
|
||||
protected function configureDatagridFilters(DatagridMapper $datagridMapper) |
||||
{ |
||||
$datagridMapper |
||||
->add('name') |
||||
; |
||||
} |
||||
|
||||
protected function configureListFields(ListMapper $listMapper) |
||||
{ |
||||
$listMapper |
||||
->addIdentifier('name') |
||||
; |
||||
} |
||||
} |
@ -1,45 +0,0 @@ |
||||
<?php |
||||
|
||||
namespace Chamilo\CoreBundle\Admin; |
||||
|
||||
use Sonata\AdminBundle\Admin\AbstractAdmin; |
||||
use Sonata\AdminBundle\Datagrid\DatagridMapper; |
||||
use Sonata\AdminBundle\Datagrid\ListMapper; |
||||
use Sonata\AdminBundle\Form\FormMapper; |
||||
use Sonata\AdminBundle\Show\ShowMapper; |
||||
|
||||
/** |
||||
* Class SessionRelCourseAdmin. |
||||
*/ |
||||
class SessionRelCourseAdmin extends AbstractAdmin |
||||
{ |
||||
protected function configureShowField(ShowMapper $showMapper) |
||||
{ |
||||
$showMapper |
||||
->add('id') |
||||
; |
||||
} |
||||
|
||||
protected function configureFormFields(FormMapper $formMapper) |
||||
{ |
||||
$formMapper |
||||
->add('course') |
||||
//->add('session') |
||||
->end() |
||||
; |
||||
} |
||||
|
||||
protected function configureDatagridFilters(DatagridMapper $datagridMapper) |
||||
{ |
||||
$datagridMapper |
||||
->add('id') |
||||
; |
||||
} |
||||
|
||||
protected function configureListFields(ListMapper $listMapper) |
||||
{ |
||||
$listMapper |
||||
->addIdentifier('id') |
||||
; |
||||
} |
||||
} |
@ -1,56 +0,0 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Admin; |
||||
|
||||
use Sonata\AdminBundle\Admin\AbstractAdmin; |
||||
use Sonata\AdminBundle\Datagrid\DatagridMapper; |
||||
use Sonata\AdminBundle\Datagrid\ListMapper; |
||||
use Sonata\AdminBundle\Form\FormMapper; |
||||
use Sonata\AdminBundle\Show\ShowMapper; |
||||
|
||||
/** |
||||
* Class SessionAdmin. |
||||
*/ |
||||
class SessionRelUserAdmin extends AbstractAdmin |
||||
{ |
||||
protected function configureFormFields(FormMapper $formMapper) |
||||
{ |
||||
$formMapper |
||||
->add('session') //if no type is specified, SonataAdminBundle tries to guess it |
||||
->add('user') |
||||
->add('relation_type', 'text') |
||||
; |
||||
|
||||
/*->add('student', 'sonata_type_model', array(), |
||||
array( |
||||
'admin_code' => 'application.subscriber.admin.student' |
||||
))*/ |
||||
} |
||||
|
||||
protected function configureShowField(ShowMapper $showMapper) |
||||
{ |
||||
$showMapper |
||||
->add('session') |
||||
->add('user') |
||||
; |
||||
} |
||||
|
||||
protected function configureDatagridFilters(DatagridMapper $datagridMapper) |
||||
{ |
||||
$datagridMapper |
||||
->add('session') |
||||
->add('user') |
||||
//->add('display_start_date', 'sonata_type_date_picker') |
||||
; |
||||
} |
||||
|
||||
protected function configureListFields(ListMapper $listMapper) |
||||
{ |
||||
$listMapper |
||||
->addIdentifier('session') |
||||
->addIdentifier('user') |
||||
; |
||||
} |
||||
} |
@ -1,50 +0,0 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Admin; |
||||
|
||||
use FOS\CKEditorBundle\Form\Type\CKEditorType; |
||||
use Sonata\AdminBundle\Admin\AbstractAdmin; |
||||
use Sonata\AdminBundle\Datagrid\DatagridMapper; |
||||
use Sonata\AdminBundle\Datagrid\ListMapper; |
||||
use Sonata\AdminBundle\Form\FormMapper; |
||||
|
||||
/** |
||||
* Class SettingsCurrentAdmin. |
||||
*/ |
||||
class SettingsCurrentAdmin extends AbstractAdmin |
||||
{ |
||||
protected function configureFormFields(FormMapper $formMapper) |
||||
{ |
||||
$formMapper |
||||
->add('title') |
||||
->add('variable') |
||||
->add('subkey') |
||||
->add('type') |
||||
->add('category') |
||||
->add('selectedValue') |
||||
->add('comment', CKEditorType::class) |
||||
->add('accessUrl') |
||||
; |
||||
} |
||||
|
||||
protected function configureDatagridFilters(DatagridMapper $datagridMapper) |
||||
{ |
||||
$datagridMapper |
||||
->add('title') |
||||
->add('variable') |
||||
->add('category') |
||||
->add('accessUrl') |
||||
; |
||||
} |
||||
|
||||
protected function configureListFields(ListMapper $listMapper) |
||||
{ |
||||
$listMapper |
||||
->addIdentifier('variable') |
||||
->add('selected_value') |
||||
->add('category') |
||||
; |
||||
} |
||||
} |
@ -1,53 +0,0 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Admin; |
||||
|
||||
use Sonata\AdminBundle\Admin\AbstractAdmin; |
||||
use Sonata\AdminBundle\Datagrid\DatagridMapper; |
||||
use Sonata\AdminBundle\Datagrid\ListMapper; |
||||
use Sonata\AdminBundle\Form\FormMapper; |
||||
|
||||
/** |
||||
* Class ToolAdmin. |
||||
*/ |
||||
class ToolAdmin extends AbstractAdmin |
||||
{ |
||||
protected function configureFormFields(FormMapper $formMapper) |
||||
{ |
||||
$formMapper |
||||
->add('name') |
||||
/*->add( |
||||
'toolResourceRight', |
||||
CollectionType::class, |
||||
[ |
||||
//'cascade_validation' => true, |
||||
], |
||||
[ |
||||
//'allow_delete' => true, |
||||
//'by_reference' => false, |
||||
'edit' => 'inline', |
||||
'inline' => 'table', |
||||
//'btn_add' => true, |
||||
//'multiple' => true |
||||
//'sortable' => 'position', |
||||
//'link_parameters' => array('content' => $users), |
||||
'admin_code' => 'sonata.admin.tool_resource_right', |
||||
] |
||||
)*/ |
||||
; |
||||
} |
||||
|
||||
protected function configureDatagridFilters(DatagridMapper $datagridMapper) |
||||
{ |
||||
$datagridMapper |
||||
->add('name'); |
||||
} |
||||
|
||||
protected function configureListFields(ListMapper $listMapper) |
||||
{ |
||||
$listMapper |
||||
->addIdentifier('name'); |
||||
} |
||||
} |
@ -1,50 +0,0 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Admin; |
||||
|
||||
use Chamilo\CoreBundle\Entity\ToolResourceRight; |
||||
use Sonata\AdminBundle\Admin\AbstractAdmin; |
||||
use Sonata\AdminBundle\Datagrid\DatagridMapper; |
||||
use Sonata\AdminBundle\Datagrid\ListMapper; |
||||
use Sonata\AdminBundle\Form\FormMapper; |
||||
|
||||
/** |
||||
* Class ToolResourceRightAdmin. |
||||
*/ |
||||
class ToolResourceRightAdmin extends AbstractAdmin |
||||
{ |
||||
protected function configureFormFields(FormMapper $formMapper) |
||||
{ |
||||
$formMapper |
||||
->add('tool') |
||||
->add( |
||||
'role', |
||||
'choice', |
||||
['choices' => ToolResourceRight::getDefaultRoles()] |
||||
) |
||||
->add( |
||||
'mask', |
||||
'choice', |
||||
['choices' => ToolResourceRight::getMaskList()] |
||||
) |
||||
; |
||||
} |
||||
|
||||
protected function configureDatagridFilters(DatagridMapper $datagridMapper) |
||||
{ |
||||
$datagridMapper |
||||
->add('role') |
||||
; |
||||
} |
||||
|
||||
protected function configureListFields(ListMapper $listMapper) |
||||
{ |
||||
$listMapper |
||||
->addIdentifier('id') |
||||
->addIdentifier('role') |
||||
->addIdentifier('mask') |
||||
; |
||||
} |
||||
} |
@ -1,81 +0,0 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Admin; |
||||
|
||||
use Chamilo\CoreBundle\Entity\Course; |
||||
use FOS\CKEditorBundle\Form\Type\CKEditorType; |
||||
use Sonata\AdminBundle\Admin\AbstractAdmin; |
||||
use Sonata\AdminBundle\Datagrid\DatagridMapper; |
||||
use Sonata\AdminBundle\Datagrid\ListMapper; |
||||
use Sonata\AdminBundle\Form\FormMapper; |
||||
use Sonata\AdminBundle\Show\ShowMapper; |
||||
|
||||
/** |
||||
* Class UserGroupAdmin. |
||||
*/ |
||||
class UserGroupAdmin extends AbstractAdmin |
||||
{ |
||||
/** |
||||
* Very important in order to save the related entities! |
||||
* |
||||
* @param Course $userGroup |
||||
* |
||||
* @return mixed|void |
||||
*/ |
||||
public function preUpdate($userGroup) |
||||
{ |
||||
//$userGroup->setUsers($userGroup->getUsers()); |
||||
} |
||||
|
||||
protected function configureFormFields(FormMapper $formMapper) |
||||
{ |
||||
$formMapper |
||||
->add('name') |
||||
->add('description', CKEditorType::class) |
||||
->add( |
||||
'users', |
||||
'sonata_type_collection', |
||||
[ |
||||
'cascade_validation' => true, |
||||
], |
||||
[ |
||||
// 'allow_delete' => true, |
||||
'by_reference' => false, |
||||
'edit' => 'inline', |
||||
'inline' => 'table', |
||||
//'btn_add' => true, |
||||
//'multiple' => true |
||||
//'sortable' => 'position', |
||||
//'link_parameters' => array('content' => $users), |
||||
'admin_code' => 'sonata.admin.user_group_rel_user', |
||||
] |
||||
) |
||||
; |
||||
} |
||||
|
||||
protected function configureShowField(ShowMapper $showMapper) |
||||
{ |
||||
$showMapper |
||||
->add('id', 'text', ['label' => 'Usergroup']) |
||||
->add('name') |
||||
; |
||||
} |
||||
|
||||
protected function configureDatagridFilters(DatagridMapper $datagridMapper) |
||||
{ |
||||
$datagridMapper |
||||
->add('id') |
||||
->add('name') |
||||
; |
||||
} |
||||
|
||||
protected function configureListFields(ListMapper $listMapper) |
||||
{ |
||||
$listMapper |
||||
->addIdentifier('id') |
||||
->addIdentifier('name') |
||||
; |
||||
} |
||||
} |
@ -1,49 +0,0 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Admin; |
||||
|
||||
use Sonata\AdminBundle\Admin\AbstractAdmin; |
||||
use Sonata\AdminBundle\Datagrid\DatagridMapper; |
||||
use Sonata\AdminBundle\Datagrid\ListMapper; |
||||
use Sonata\AdminBundle\Form\FormMapper; |
||||
use Sonata\AdminBundle\Show\ShowMapper; |
||||
|
||||
/** |
||||
* Class UsergroupRelUser. |
||||
*/ |
||||
class UsergroupRelUser extends AbstractAdmin |
||||
{ |
||||
protected function configureFormFields(FormMapper $formMapper) |
||||
{ |
||||
$formMapper |
||||
->add('user') |
||||
->add('usergroup') |
||||
; |
||||
} |
||||
|
||||
protected function configureShowField(ShowMapper $showMapper) |
||||
{ |
||||
$showMapper |
||||
->add('user') |
||||
->add('usergroup') |
||||
; |
||||
} |
||||
|
||||
protected function configureDatagridFilters(DatagridMapper $datagridMapper) |
||||
{ |
||||
$datagridMapper |
||||
->add('user') |
||||
->add('usergroup') |
||||
; |
||||
} |
||||
|
||||
protected function configureListFields(ListMapper $listMapper) |
||||
{ |
||||
$listMapper |
||||
->addIdentifier('user') |
||||
->addIdentifier('usergroup') |
||||
; |
||||
} |
||||
} |
@ -1,112 +0,0 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Block; |
||||
|
||||
use Chamilo\CoreBundle\Entity\Course; |
||||
use Chamilo\CoreBundle\Entity\Session; |
||||
use Sonata\BlockBundle\Block\BlockContextInterface; |
||||
use Sonata\SeoBundle\Block\Breadcrumb\BaseBreadcrumbMenuBlockService; |
||||
use Symfony\Component\OptionsResolver\OptionsResolver; |
||||
|
||||
/** |
||||
* Class BreadcrumbBlockService. |
||||
*/ |
||||
class BreadcrumbBlockService extends BaseBreadcrumbMenuBlockService |
||||
{ |
||||
protected $extraChildren; |
||||
|
||||
public function getName() |
||||
{ |
||||
return 'chamilo_core.block.breadcrumb'; |
||||
} |
||||
|
||||
public function configureSettings(OptionsResolver $resolver) |
||||
{ |
||||
parent::configureSettings($resolver); |
||||
|
||||
$resolver->setDefaults([ |
||||
//'menu_template' => 'SonataSeoBundle:Block:breadcrumb.html.twig', |
||||
'menu_template' => '@ChamiloCore/Breadcrumb/breadcrumb_legacy.html.twig', |
||||
'include_homepage_link' => false, |
||||
'context' => false, |
||||
]); |
||||
} |
||||
|
||||
/** |
||||
* @param string $title |
||||
* @param array $params |
||||
*/ |
||||
public function addChild($title, $params = []) |
||||
{ |
||||
$this->extraChildren[] = ['title' => $title, 'params' => $params]; |
||||
} |
||||
|
||||
protected function getMenu(BlockContextInterface $blockContext) |
||||
{ |
||||
$menu = $this->getRootMenu($blockContext); |
||||
$menu->addChild('', ['route' => 'home'])->setExtra('icon', 'fas fa-home'); |
||||
$sessionId = 0; |
||||
// Course/Session block are set here src/ThemeBundle/Resources/views/Layout/breadcrumb.html.twig |
||||
if ($blockContext->getBlock()->getSetting('session')) { |
||||
/** @var Session $course */ |
||||
$session = $blockContext->getBlock()->getSetting('session'); |
||||
if ($session && $session instanceof Session) { |
||||
$sessionId = $session->getId(); |
||||
} |
||||
} |
||||
|
||||
// Add course |
||||
/** @var Course $course */ |
||||
if ($course = $blockContext->getBlock()->getSetting('course')) { |
||||
$title = $course->getTitle(); |
||||
$courseId = $course->getId(); |
||||
|
||||
$menu->addChild( |
||||
$title, |
||||
[ |
||||
'route' => 'chamilo_core_course_home', |
||||
'routeParameters' => [ |
||||
'cid' => $courseId, |
||||
'sid' => $sessionId, |
||||
], |
||||
] |
||||
); |
||||
} |
||||
|
||||
if (!empty($this->extraChildren)) { |
||||
foreach ($this->extraChildren as $item) { |
||||
$params = isset($item['params']) ? $item['params'] : []; |
||||
$menu->addChild( |
||||
$item['title'], |
||||
$params |
||||
); |
||||
} |
||||
} |
||||
|
||||
// Load legacy breadcrumbs |
||||
$oldBreadCrumb = $blockContext->getBlock()->getSetting('legacy_breadcrumb'); |
||||
|
||||
if ($oldBreadCrumb) { |
||||
foreach ($oldBreadCrumb as $data) { |
||||
if (empty($data['name'])) { |
||||
continue; |
||||
} |
||||
$url = $data['url']; |
||||
if ('#' === $url) { |
||||
$menu->addChild($data['name']); |
||||
} else { |
||||
$menu->addChild($data['name'], ['uri' => $url]); |
||||
} |
||||
} |
||||
} |
||||
|
||||
// Set CSS classes for the items |
||||
foreach ($menu->getChildren() as $child) { |
||||
$child->setAttribute('class', 'breadcrumb-item'); |
||||
} |
||||
|
||||
return $menu; |
||||
} |
||||
} |
@ -1,65 +0,0 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Block; |
||||
|
||||
use Sonata\AdminBundle\Form\FormMapper; |
||||
use Sonata\BlockBundle\Block\BlockContextInterface; |
||||
use Sonata\BlockBundle\Block\Service\AbstractBlockService; |
||||
use Sonata\BlockBundle\Model\BlockInterface; |
||||
use Sonata\CoreBundle\Validator\ErrorElement; |
||||
use Symfony\Component\HttpFoundation\Response; |
||||
use Symfony\Component\OptionsResolver\OptionsResolver; |
||||
|
||||
/** |
||||
* Class CourseBlockService. |
||||
*/ |
||||
class CourseBlockService extends AbstractBlockService |
||||
{ |
||||
/** |
||||
* @return string |
||||
*/ |
||||
public function getName() |
||||
{ |
||||
return 'Course block'; |
||||
} |
||||
|
||||
public function configureSettings(OptionsResolver $resolver) |
||||
{ |
||||
$resolver->setDefaults([ |
||||
'url' => false, |
||||
'title' => 'Course block', |
||||
'template' => '@ChamiloCore/Block/course.html.twig', |
||||
'ttl' => 0, |
||||
]); |
||||
} |
||||
|
||||
public function validateBlock(ErrorElement $errorElement, BlockInterface $block) |
||||
{ |
||||
} |
||||
|
||||
public function buildEditForm(FormMapper $formMapper, BlockInterface $block) |
||||
{ |
||||
} |
||||
|
||||
/** |
||||
* @return Response |
||||
*/ |
||||
public function execute(BlockContextInterface $blockContext, Response $response = null) |
||||
{ |
||||
// merge settings |
||||
$settings = $blockContext->getSettings(); |
||||
$hotCourses = \CourseManager::return_hot_courses(); |
||||
|
||||
return $this->renderResponse( |
||||
$blockContext->getTemplate(), |
||||
[ |
||||
'hot_courses' => $hotCourses, |
||||
'block' => $blockContext->getBlock(), |
||||
'settings' => $settings, |
||||
], |
||||
$response |
||||
); |
||||
} |
||||
} |
@ -1,67 +0,0 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Block; |
||||
|
||||
use Sonata\AdminBundle\Form\FormMapper; |
||||
use Sonata\BlockBundle\Block\BlockContextInterface; |
||||
use Sonata\BlockBundle\Block\Service\AbstractBlockService; |
||||
use Sonata\BlockBundle\Model\BlockInterface; |
||||
use Sonata\CoreBundle\Validator\ErrorElement; |
||||
use Symfony\Component\HttpFoundation\Response; |
||||
use Symfony\Component\OptionsResolver\OptionsResolver; |
||||
|
||||
/** |
||||
* Class CourseBlockService. |
||||
*/ |
||||
class SkillBlockService extends AbstractBlockService |
||||
{ |
||||
/** |
||||
* @return string |
||||
*/ |
||||
public function getName() |
||||
{ |
||||
return 'Skill block'; |
||||
} |
||||
|
||||
public function configureSettings(OptionsResolver $resolver) |
||||
{ |
||||
$resolver->setDefaults( |
||||
[ |
||||
'template' => '@ChamiloCore/Block/skill.html.twig', |
||||
'ttl' => 0, |
||||
] |
||||
); |
||||
} |
||||
|
||||
public function validateBlock( |
||||
ErrorElement $errorElement, |
||||
BlockInterface $block |
||||
) { |
||||
} |
||||
|
||||
public function buildEditForm(FormMapper $formMapper, BlockInterface $block) |
||||
{ |
||||
} |
||||
|
||||
/** |
||||
* @return Response |
||||
*/ |
||||
public function execute( |
||||
BlockContextInterface $blockContext, |
||||
Response $response = null |
||||
) { |
||||
// merge settings |
||||
$settings = $blockContext->getSettings(); |
||||
|
||||
return $this->renderResponse( |
||||
$blockContext->getTemplate(), |
||||
[ |
||||
'block' => $blockContext->getBlock(), |
||||
'settings' => $settings, |
||||
], |
||||
$response |
||||
); |
||||
} |
||||
} |
Loading…
Reference in new issue