Updates in NotebookBundle

1.10.x
Julio Montoya 10 years ago
parent 8d353cc1dc
commit faac2a098d
  1. 80
      app/SymfonyRequirements.php
  2. 4
      app/config/config.yml
  3. 2
      app/config/security.yml
  4. 15
      composer.json
  5. 23
      src/Chamilo/NotebookBundle/Controller/NotebookController.php
  6. 20
      src/Chamilo/NotebookBundle/Form/Type/NotebookType.php
  7. 12
      src/Chamilo/NotebookBundle/Resources/config/routing.yml
  8. 4
      src/Chamilo/NotebookBundle/Resources/config/services.yml

@ -117,16 +117,16 @@ class PhpIniRequirement extends Requirement
/**
* Constructor that initializes the requirement.
*
* @param string $cfgName The configuration name used for ini_get()
* @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false,
or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
* @param string $cfgName The configuration name used for ini_get()
* @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false,
or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
* @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
* @param string|null $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived)
* @param string|null $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived)
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
* @param bool $optional Whether this is only an optional recommendation not a mandatory requirement
This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
* @param string|null $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived)
* @param string|null $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived)
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
* @param bool $optional Whether this is only an optional recommendation not a mandatory requirement
*/
public function __construct($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null, $optional = false)
{
@ -219,15 +219,15 @@ class RequirementCollection implements IteratorAggregate
/**
* Adds a mandatory requirement in form of a php.ini configuration.
*
* @param string $cfgName The configuration name used for ini_get()
* @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false,
or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
* @param string $cfgName The configuration name used for ini_get()
* @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false,
or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
* @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
* @param string $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived)
* @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived)
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
* @param string $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived)
* @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived)
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
*/
public function addPhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null)
{
@ -237,15 +237,15 @@ class RequirementCollection implements IteratorAggregate
/**
* Adds an optional recommendation in form of a php.ini configuration.
*
* @param string $cfgName The configuration name used for ini_get()
* @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false,
or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
* @param string $cfgName The configuration name used for ini_get()
* @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false,
or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
* @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
* @param string $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived)
* @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived)
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
* @param string $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived)
* @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived)
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
*/
public function addPhpIniRecommendation($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null)
{
@ -682,10 +682,8 @@ class SymfonyRequirements extends RequirementCollection
);
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$this->addPhpIniRecommendation(
'realpath_cache_size',
create_function('$cfgValue', 'return (int) $cfgValue > 1000;'),
false,
$this->addRecommendation(
$this->getRealpathCacheSize() > 1000,
'realpath_cache_size should be above 1024 in php.ini',
'Set "<strong>realpath_cache_size</strong>" to e.g. "<strong>1024</strong>" in php.ini<a href="#phpini">*</a> to improve performance on windows.'
);
@ -714,4 +712,28 @@ class SymfonyRequirements extends RequirementCollection
);
}
}
/**
* Loads realpath_cache_size from php.ini and converts it to int.
*
* (e.g. 16k is converted to 16384 int)
*
* @return int
*/
protected function getRealpathCacheSize()
{
$size = ini_get('realpath_cache_size');
$size = trim($size);
$unit = strtolower(substr($size, -1, 1));
switch ($unit) {
case 'g':
return $size * 1024 * 1024 * 1024;
case 'm':
return $size * 1024 * 1024;
case 'k':
return $size * 1024;
default:
return (int) $size;
}
}
}

@ -227,7 +227,7 @@ stof_doctrine_extensions:
sylius_resource:
resources:
chamilo_notebook.resource:
chamilo_notebook.notebook:
driver: doctrine/orm
templates: ChamiloNotebookBundle:Notebook
classes:
@ -235,7 +235,7 @@ sylius_resource:
repository: Chamilo\NotebookBundle\Entity\NotebookRepository
controller: Chamilo\NotebookBundle\Controller\NotebookController
chamilo_course.tool.resource:
chamilo_course.tool:
driver: doctrine/orm
templates: ChamiloCourseBundle:Tool
classes:

@ -13,9 +13,7 @@ security:
- ROLE_DIRECTOR
- ROLE_JURY_PRESIDENT
ROLE_SUPER_ADMIN: [ROLE_SONATA_ADMIN, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
ROLE_GLOBAL_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
ROLE_RRHH: [ROLE_TEACHER]
ROLE_TEACHER: [ROLE_STUDENT]
ROLE_QUESTION_MANAGER: [ROLE_STUDENT, ROLE_QUESTION_MANAGER]

@ -117,7 +117,7 @@
"simplethings/entity-audit-bundle": "~0.7",
"willdurand/faker-bundle": "~1.0",
"mopa/bootstrap-bundle": "v3.0.0-beta4",
"mopa/bootstrap-bundle": "dev-master",
"twbs/bootstrap": "~3.0",
"stof/doctrine-extensions-bundle": "~1.1",
@ -125,7 +125,6 @@
"stephpy/timeline": "~1.0",
"incenteev/composer-parameter-handler": "~2.0",
"friendsofsymfony/advanced-encoder-bundle": "~1.0",
"friendsofsymfony/message-bundle": "~1.2",
"oyejorge/less.php": "~1.0",
@ -139,12 +138,12 @@
"liip/theme-bundle": "dev-master",
"chamilo/chash" : "dev-master",
"white-october/pagerfanta-bundle": "dev-master",
"sylius/resource-bundle": "0.11",
"sylius/resource": "0.11",
"sylius/flow-bundle": "0.11",
"sylius/settings-bundle": "0.11",
"sylius/attribute-bundle": "0.11",
"sylius/variation": "0.11",
"sylius/resource-bundle": "~0.1",
"sylius/resource": "~0.1",
"sylius/flow-bundle": "~0.1",
"sylius/settings-bundle": "~0.1",
"sylius/attribute-bundle": "~0.1",
"sylius/variation": "~0.1",
"apy/datagrid-bundle": "dev-master",
"jms/translation-bundle": "~1.0",

@ -216,23 +216,8 @@ class NotebookController extends ToolBaseCrudController
/** @var AbstractResource $resource */
$resource = $this->getRepository()->find($id);
$this->domainManager->delete($resource);
//$this->getManager()->
}
/**
* {@inheritdoc}
*/
/*public function createNew()
{
$notebook = $this->getNotebookRepository()->createNewWithCourse(
$this->getUser(),
$this->getCourse()
);
return $notebook;
}*/
/**
* @return NotebookManager
*/
@ -240,12 +225,4 @@ class NotebookController extends ToolBaseCrudController
{
return $this->get('chamilo_notebook.entity.notebook_manager');
}
/**
* @return NotebookRepository
*/
protected function getNotebookRepository()
{
return $this->get('chamilo.repository.notebook');
}
}

@ -8,24 +8,25 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* Class CNotebookType
* Class NotebookType
* @package Chamilo\NotebookBundle\Form\Type
*/
class CNotebookType extends AbstractType
class NotebookType extends AbstractType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name')
->add('description', 'ckeditor')
/*->add('cId')
->add('notebookId')
->add('userId')
->add('course')
->add('sessionId')*/
->add('save', 'submit');
}
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
@ -33,8 +34,11 @@ class CNotebookType extends AbstractType
));
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'chamilo_notebook';
return 'chamilo_notebook_notebook';
}
}

@ -7,13 +7,13 @@ chamilo_notebook_index:
pattern: courses/{course}/notebook
methods: [GET, POST, HEAD, DELETE]
defaults:
_controller: chamilo_notebook.controller.resource:indexAction
_controller: chamilo_notebook.controller.notebook:indexAction
chamilo_notebook_new:
pattern: courses/{course}/notebook/new
methods: [GET, POST]
defaults:
_controller: chamilo_notebook.controller.resource:createAction
_controller: chamilo_notebook.controller.notebook:createAction
_sylius:
redirect:
route: chamilo_notebook_index
@ -29,7 +29,7 @@ chamilo_notebook_show:
requirements:
id: \d+
defaults:
_controller: chamilo_notebook.controller.resource:showAction
_controller: chamilo_notebook.controller.notebook:showAction
_sylius:
criteria: { id: $id }
@ -39,7 +39,7 @@ chamilo_notebook_edit:
requirements:
id: \d+
defaults:
_controller: chamilo_notebook.controller.resource:updateAction
_controller: chamilo_notebook.controller.notebook:updateAction
_sylius:
redirect:
route: chamilo_notebook_show
@ -51,7 +51,7 @@ chamilo_notebook_delete:
requirements:
id: \d+
defaults:
_controller: chamilo_notebook.controller.resource:deleteAction
_controller: chamilo_notebook.controller.notebook:deleteAction
_sylius:
redirect:
route: chamilo_notebook_index
@ -61,4 +61,4 @@ chamilo_notebook_delete_many:
pattern: courses/{course}/notebook/delete_many
methods: [GET, POST, DELETE]
defaults:
_controller: chamilo_notebook.controller.resource:deleteMassAction
_controller: chamilo_notebook.controller.notebook:deleteMassAction

@ -14,8 +14,8 @@ services:
- { name: chamilo_course.tool }
# Form (add/edit)
chamilo_notebook.form.type.c_notebook_type:
class: Chamilo\NotebookBundle\Form\Type\CNotebookType
chamilo_notebook_notebook:
class: Chamilo\NotebookBundle\Form\Type\NotebookType
tags:
- { name: form.type }

Loading…
Cancel
Save