Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 15390 | Rev 16768 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 15390 Rev 16766
Línea 2... Línea 2...
2
declare(strict_types=1);
2
declare(strict_types=1);
Línea 3... Línea 3...
3
 
3
 
Línea 4... Línea 4...
4
namespace LeadersLinked\Controller;
4
namespace LeadersLinked\Controller;
5
 
5
 
6
use Laminas\Db\Adapter\AdapterInterface;
6
use Laminas\Db\Adapter\AdapterInterface;
7
use Laminas\Cache\Storage\Adapter\AbstractAdapter;
7
use LeadersLinked\Cache\CacheInterface;
8
use Laminas\Mvc\Controller\AbstractActionController;
8
use Laminas\Mvc\Controller\AbstractActionController;
9
use Laminas\Log\LoggerInterface;
9
use Laminas\Log\LoggerInterface;
10
use Laminas\View\Model\ViewModel;
10
use Laminas\View\Model\ViewModel;
Línea 48... Línea 48...
48
use LeadersLinked\Form\TopicReportForm;
48
use LeadersLinked\Form\TopicReportForm;
49
use LeadersLinked\Model\User;
49
use LeadersLinked\Model\User;
50
use LeadersLinked\Mapper\CompanyUserMapper;
50
use LeadersLinked\Mapper\CompanyUserMapper;
51
use Laminas\Db\Sql\Select;
51
use Laminas\Db\Sql\Select;
52
use LeadersLinked\Form\StudentReportForm;
52
use LeadersLinked\Form\StudentReportForm;
-
 
53
use LeadersLinked\Library\Functions;
Línea 53... Línea 54...
53
 
54
 
54
 
55
 
Línea 62... Línea 63...
62
    private $adapter;
63
    private $adapter;
Línea 63... Línea 64...
63
    
64
    
64
    
65
    
65
    /**
66
    /**
66
     *
67
     *
67
     * @var AbstractAdapter
68
     * @var CacheInterface
Línea 68... Línea 69...
68
     */
69
     */
69
    private $cache;
70
    private $cache;
Línea 76... Línea 77...
76
   
77
   
77
    
78
    
78
    /**
79
    /**
79
     *
80
     *
80
     * @param AdapterInterface $adapter
81
     * @param AdapterInterface $adapter
81
     * @param AbstractAdapter $cache
82
     *@param CacheInterface $cache
82
     * @param LoggerInterface $logger
83
     * @param LoggerInterface $logger
83
     * @param array $config
84
     * @param array $config
84
     */
85
     */
Línea 752... Línea 753...
752
            
753
            
753
            if($isJson) {
754
            if($isJson) {
754
                $acl = $this->getEvent()->getViewModel()->getVariable('acl');
755
                $acl = $this->getEvent()->getViewModel()->getVariable('acl');
Línea 755... Línea 756...
755
                $allowDownload = $acl->isAllowed($currentUser->usertype_id, 'microlearning/reports/progress-for-capsule/excel');
756
                $allowDownload = $acl->isAllowed($currentUser->usertype_id, 'microlearning/reports/progress-for-capsule/excel');
756
                
757
                
757
                $company_id = filter_var($this->params()->fromQuery('company_id', ''), FILTER_SANITIZE_STRING);
758
                $company_id = Functions::sanitizeFilterString($this->params()->fromQuery('company_id', ''));
758
                $function_id = filter_var($this->params()->fromQuery('function_id', ''), FILTER_SANITIZE_STRING);
759
                $function_id = Functions::sanitizeFilterString($this->params()->fromQuery('function_id', ''));
759
                $group_id = filter_var($this->params()->fromQuery('group_id', ''), FILTER_SANITIZE_STRING);
760
                $group_id = Functions::sanitizeFilterString($this->params()->fromQuery('group_id', ''));
760
                $institution_id = filter_var($this->params()->fromQuery('institution_id', ''), FILTER_SANITIZE_STRING);
761
                $institution_id = Functions::sanitizeFilterString($this->params()->fromQuery('institution_id', ''));
761
                $program_id = filter_var($this->params()->fromQuery('program_id', ''), FILTER_SANITIZE_STRING);
762
                $program_id = Functions::sanitizeFilterString($this->params()->fromQuery('program_id', ''));
762
                $partner_id = filter_var($this->params()->fromQuery('partner_id', ''), FILTER_SANITIZE_STRING);
763
                $partner_id = Functions::sanitizeFilterString($this->params()->fromQuery('partner_id', ''));
Línea 763... Línea 764...
763
                $sector_id = filter_var($this->params()->fromQuery('sector_id', ''), FILTER_SANITIZE_STRING);
764
                $sector_id = Functions::sanitizeFilterString($this->params()->fromQuery('sector_id', ''));
764
                $student_type_id = filter_var($this->params()->fromQuery('student_type_id', ''), FILTER_SANITIZE_STRING);
765
                $student_type_id = Functions::sanitizeFilterString($this->params()->fromQuery('student_type_id', ''));
765
 
766
 
Línea 1034... Línea 1035...
1034
        $request = $this->getRequest();
1035
        $request = $this->getRequest();
Línea 1035... Línea 1036...
1035
        
1036
        
1036
        if($request->isGet())
1037
        if($request->isGet())
Línea 1037... Línea 1038...
1037
        {
1038
        {
1038
            
1039
            
1039
            $company_id = filter_var($this->params()->fromQuery('company_id', ''), FILTER_SANITIZE_STRING);
1040
            $company_id = Functions::sanitizeFilterString($this->params()->fromQuery('company_id', ''));
1040
            $function_id = filter_var($this->params()->fromQuery('function_id', ''), FILTER_SANITIZE_STRING);
1041
            $function_id = Functions::sanitizeFilterString($this->params()->fromQuery('function_id', ''));
1041
            $group_id = filter_var($this->params()->fromQuery('group_id', ''), FILTER_SANITIZE_STRING);
1042
            $group_id = Functions::sanitizeFilterString($this->params()->fromQuery('group_id', ''));
1042
            $institution_id = filter_var($this->params()->fromQuery('institution_id', ''), FILTER_SANITIZE_STRING);
1043
            $institution_id = Functions::sanitizeFilterString($this->params()->fromQuery('institution_id', ''));
1043
            $program_id = filter_var($this->params()->fromQuery('program_id', ''), FILTER_SANITIZE_STRING);
1044
            $program_id = Functions::sanitizeFilterString($this->params()->fromQuery('program_id', ''));
1044
            $partner_id = filter_var($this->params()->fromQuery('partner_id', ''), FILTER_SANITIZE_STRING);
1045
            $partner_id = Functions::sanitizeFilterString($this->params()->fromQuery('partner_id', ''));
Línea 1045... Línea 1046...
1045
            $sector_id = filter_var($this->params()->fromQuery('sector_id', ''), FILTER_SANITIZE_STRING);
1046
            $sector_id = Functions::sanitizeFilterString($this->params()->fromQuery('sector_id', ''));
1046
            $student_type_id = filter_var($this->params()->fromQuery('student_type_id', ''), FILTER_SANITIZE_STRING);
1047
            $student_type_id = Functions::sanitizeFilterString($this->params()->fromQuery('student_type_id', ''));
1047
            
1048
            
Línea 1366... Línea 1367...
1366
                    
1367
                    
1367
                }
1368
                }
Línea 1368... Línea 1369...
1368
            }
1369
            }
1369
            
1370
            
1370
            if($isJson) {
1371
            if($isJson) {
Línea 1371... Línea 1372...
1371
                $topic_uuid     = filter_var($this->params()->fromQuery('topic_uuid'), FILTER_SANITIZE_STRING);
1372
                $topic_uuid     = Functions::sanitizeFilterString($this->params()->fromQuery('topic_uuid'));
1372
                $capsule_uuid   = filter_var($this->params()->fromQuery('capsule_uuid'), FILTER_SANITIZE_STRING);
1373
                $capsule_uuid   = Functions::sanitizeFilterString($this->params()->fromQuery('capsule_uuid'));
1373
                
1374
                
Línea 1449... Línea 1450...
1449
                    ]);
1450
                    ]);
1450
                }
1451
                }
Línea 1451... Línea 1452...
1451
                
1452
                
1452
 
1453
 
Línea 1453... Línea 1454...
1453
                $search = $this->params()->fromQuery('search', []);
1454
                $search = $this->params()->fromQuery('search', []);
1454
                $search = empty($search['value']) ? '' : filter_var($search['value'], FILTER_SANITIZE_STRING);
1455
                $search = empty($search['value']) ? '' :  Functions::sanitizeFilterString($search['value']);
1455
                
1456
                
1456
                $page               = intval($this->params()->fromQuery('start', 1), 10);
1457
                $page               = intval($this->params()->fromQuery('start', 1), 10);
1457
                $records_x_page     = intval($this->params()->fromQuery('length', 10), 10);
1458
                $records_x_page     = intval($this->params()->fromQuery('length', 10), 10);
Línea 1458... Línea 1459...
1458
                $order =  $this->params()->fromQuery('order', []);
1459
                $order =  $this->params()->fromQuery('order', []);
1459
                $order_field        = empty($order[0]['column']) ? 99 :  intval($order[0]['column'], 10);
1460
                $order_field        = empty($order[0]['column']) ? 99 :  intval($order[0]['column'], 10);
Línea 1460... Línea 1461...
1460
                $order_direction    = empty($order[0]['dir']) ? 'ASC' : strtoupper(filter_var( $order[0]['dir'], FILTER_SANITIZE_STRING));
1461
                $order_direction    = empty($order[0]['dir']) ? 'ASC' : strtoupper(Functions::sanitizeFilterString($order[0]['dir']));
Línea 1600... Línea 1601...
1600
   
1601
   
1601
            if($isJson) {
1602
            if($isJson) {
1602
                $acl = $this->getEvent()->getViewModel()->getVariable('acl');
1603
                $acl = $this->getEvent()->getViewModel()->getVariable('acl');
Línea 1603... Línea 1604...
1603
                $allowDownload = $acl->isAllowed($currentUser->usertype_id, 'microlearning/reports/progress-for-capsule/excel');
1604
                $allowDownload = $acl->isAllowed($currentUser->usertype_id, 'microlearning/reports/progress-for-capsule/excel');
1604
                
1605
                
Línea 1605... Línea 1606...
1605
                $topic_uuid     = filter_var($this->params()->fromQuery('topic_uuid'), FILTER_SANITIZE_STRING);
1606
                $topic_uuid     = Functions::sanitizeFilterString($this->params()->fromQuery('topic_uuid'));
1606
                $capsule_uuid   = filter_var($this->params()->fromQuery('capsule_uuid'), FILTER_SANITIZE_STRING);
1607
                $capsule_uuid   = Functions::sanitizeFilterString($this->params()->fromQuery('capsule_uuid'));
1607
 
1608
 
1608
                $topicMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
1609
                $topicMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
Línea 1808... Línea 1809...
1808
        $request = $this->getRequest();
1809
        $request = $this->getRequest();
Línea 1809... Línea 1810...
1809
        
1810
        
1810
        if($request->isGet())
1811
        if($request->isGet())
Línea 1811... Línea 1812...
1811
        {
1812
        {
1812
            
1813
            
Línea 1813... Línea 1814...
1813
            $topic_uuid     = filter_var($this->params()->fromQuery('topic_uuid'), FILTER_SANITIZE_STRING);
1814
            $topic_uuid     = Functions::sanitizeFilterString($this->params()->fromQuery('topic_uuid'));
1814
            $capsule_uuid   = filter_var($this->params()->fromQuery('capsule_uuid'), FILTER_SANITIZE_STRING);
1815
            $capsule_uuid   = Functions::sanitizeFilterString($this->params()->fromQuery('capsule_uuid'));
1815
                
1816
                
Línea 2040... Línea 2041...
2040
            
2041
            
2041
            if($isJson) {
2042
            if($isJson) {
2042
                $acl = $this->getEvent()->getViewModel()->getVariable('acl');
2043
                $acl = $this->getEvent()->getViewModel()->getVariable('acl');
Línea 2043... Línea 2044...
2043
                $allowDownload = $acl->isAllowed($currentUser->usertype_id, 'microlearning/reports/progress-for-topic/excel');
2044
                $allowDownload = $acl->isAllowed($currentUser->usertype_id, 'microlearning/reports/progress-for-topic/excel');
Línea 2044... Línea 2045...
2044
                
2045
                
2045
                $topic_uuid     = filter_var($this->params()->fromQuery('topic_uuid'), FILTER_SANITIZE_STRING);
2046
                $topic_uuid     = Functions::sanitizeFilterString($this->params()->fromQuery('topic_uuid'));
2046
 
2047
 
2047
                $topicMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
2048
                $topicMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
Línea 2263... Línea 2264...
2263
        $request = $this->getRequest();
2264
        $request = $this->getRequest();
Línea 2264... Línea 2265...
2264
        
2265
        
2265
        if($request->isGet())
2266
        if($request->isGet())
Línea 2266... Línea 2267...
2266
        {
2267
        {
Línea 2267... Línea 2268...
2267
            
2268
            
2268
            $topic_uuid     = filter_var($this->params()->fromQuery('topic_uuid'), FILTER_SANITIZE_STRING);
2269
            $topic_uuid     = Functions::sanitizeFilterString($this->params()->fromQuery('topic_uuid'));
2269
            
2270
            
2270
            $topicMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
2271
            $topicMapper = CompanyMicrolearningTopicMapper::getInstance($this->adapter);
Línea 2534... Línea 2535...
2534
            if($isJson) {
2535
            if($isJson) {
Línea 2535... Línea 2536...
2535
                
2536
                
2536
                $acl = $this->getEvent()->getViewModel()->getVariable('acl');
2537
                $acl = $this->getEvent()->getViewModel()->getVariable('acl');
Línea 2537... Línea 2538...
2537
                $allowDownload = $acl->isAllowed($currentUser->usertype_id, 'microlearning/reports/progress-for-student/excel');
2538
                $allowDownload = $acl->isAllowed($currentUser->usertype_id, 'microlearning/reports/progress-for-student/excel');
Línea 2538... Línea 2539...
2538
 
2539
 
2539
                $student_uuid     = filter_var($this->params()->fromQuery('student_uuid'), FILTER_SANITIZE_STRING);
2540
                $student_uuid     = Functions::sanitizeFilterString($this->params()->fromQuery('student_uuid'));
Línea 2683... Línea 2684...
2683
        $request = $this->getRequest();
2684
        $request = $this->getRequest();
Línea 2684... Línea 2685...
2684
        
2685
        
2685
        if($request->isGet())
2686
        if($request->isGet())
Línea 2686... Línea 2687...
2686
        {
2687
        {
Línea 2687... Línea 2688...
2687
            
2688
            
2688
            $student_uuid     = filter_var($this->params()->fromQuery('student_uuid'), FILTER_SANITIZE_STRING);
2689
            $student_uuid     = Functions::sanitizeFilterString($this->params()->fromQuery('student_uuid'));