Proyectos de Subversion LeadersLinked - Services

Rev

Rev 661 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 661 Rev 662
Línea 548... Línea 548...
548
    }
548
    }
Línea 549... Línea 549...
549
 
549
 
550
    /**
550
    /**
551
     * Update the progress of a slide
551
     * Update the progress of a slide
-
 
552
     * @param int $user_id
552
     * @param int $user_id
553
     * @param int $company_id
553
     * @param int $slide_id
554
     * @param int $slide_id
554
     * @param int $capsule_id
555
     * @param int $capsule_id
555
     * @param int $topic_id
556
     * @param int $topic_id
556
     * @return int
557
     * @return bool
557
     */
558
     */
558
    public function updateSlideProgress($user_id, $slide_id, $capsule_id, $topic_id){
559
    public function updateSlideProgress($user_id, $company_id, $slide_id, $capsule_id, $topic_id){
-
 
560
        $userProgress = $this->fetchOneByUserIdAndSlideId($user_id, $slide_id);
-
 
561
        $now = date('Y-m-d H:i:s');
559
        $userProgress = $this->fetchOneByUserIdAndSlideId($user_id, $slide_id);
562
 
-
 
563
        if (!$userProgress) {
560
        if(!$userProgress){
564
            // Crear nuevo progreso
561
            $userProgress = new MicrolearningUserProgress();
565
            $userProgress = new MicrolearningUserProgress();
-
 
566
            $userProgress->user_id = $user_id;
562
            $userProgress->user_id = $user_id;
567
            $userProgress->company_id = $company_id;
563
            $userProgress->slide_id = $slide_id;
568
            $userProgress->slide_id = $slide_id;
564
            $userProgress->capsule_id = $capsule_id;
569
            $userProgress->capsule_id = $capsule_id;
565
            $userProgress->topic_id = $topic_id;
570
            $userProgress->topic_id = $topic_id;
566
            $userProgress->type = MicrolearningUserProgress::TYPE_SLIDE;
571
            $userProgress->type = MicrolearningUserProgress::TYPE_SLIDE;
567
            $userProgress->progress = 100;
572
            $userProgress->progress = 100;
568
            $userProgress->completed = 1;
573
            $userProgress->completed = 1;
569
            $userProgress->added_on = date('Y-m-d H:i:s');
574
            $userProgress->added_on = $now;
570
            $userProgress->updated_on = date('Y-m-d H:i:s');
575
            $userProgress->updated_on = $now;
571
            return $this->insert($userProgress);
576
            return $this->insert($userProgress);
-
 
577
        } else {
572
        } else {
578
            // Actualizar progreso existente
573
            $userProgress->progress = 100;
579
            $userProgress->progress = 100;
574
            $userProgress->completed = 1;
580
            $userProgress->completed = 1;
575
            $userProgress->updated_on = date('Y-m-d H:i:s');
581
            $userProgress->updated_on = $now;
576
            return $this->update($userProgress);
582
            return $this->update($userProgress);
577
        }
583
        }
Línea 578... Línea 584...
578
    }
584
    }
Línea 598... Línea 604...
598
    }
604
    }
Línea 599... Línea 605...
599
 
605
 
600
    /**
606
    /**
601
     * Update the progress of a capsule
607
     * Update the progress of a capsule
-
 
608
     * @param int $user_id
602
     * @param int $user_id
609
     * @param int $company_id
603
     * @param int $slide_id
610
     * @param int $slide_id
604
     * @param int $capsule_id
611
     * @param int $capsule_id
605
     * @param int $topic_id
612
     * @param int $topic_id
606
     * @return int
613
     * @return int
607
     */
614
     */
608
    public function updateCapsuleProgress($user_id, $slide_id, $capsule_id, $topic_id){
615
    public function updateCapsuleProgress($user_id, $company_id, $slide_id, $capsule_id, $topic_id){
609
        // Get total slides in the capsule
616
        // Get total slides in the capsule
Línea 610... Línea 617...
610
        $totalSlides = $this->slideMapper->fetchTotalCountByCapsuleId($capsule_id);
617
        $totalSlides = $this->slideMapper->fetchTotalCountByCapsuleId($capsule_id);
611
 
618
 
Línea 618... Línea 625...
618
 
625
 
619
        $userProgress = $this->fetchOneByUserIdAndCapsuleId($user_id, $capsule_id);
626
        $userProgress = $this->fetchOneByUserIdAndCapsuleId($user_id, $capsule_id);
620
        if(!$userProgress){
627
        if(!$userProgress){
621
            $userProgress = new MicrolearningUserProgress();
628
            $userProgress = new MicrolearningUserProgress();
-
 
629
            $userProgress->user_id = $user_id;
622
            $userProgress->user_id = $user_id;
630
            $userProgress->company_id = $company_id;
623
            $userProgress->slide_id = $slide_id;
631
            $userProgress->slide_id = $slide_id;
624
            $userProgress->capsule_id = $capsule_id;
632
            $userProgress->capsule_id = $capsule_id;
625
            $userProgress->topic_id = $topic_id;
633
            $userProgress->topic_id = $topic_id;
626
            $userProgress->type = MicrolearningUserProgress::TYPE_CAPSULE;
634
            $userProgress->type = MicrolearningUserProgress::TYPE_CAPSULE;
Línea 657... Línea 665...
657
    }
665
    }
Línea 658... Línea 666...
658
 
666
 
659
    /**
667
    /**
660
     * Update the progress of a topic
668
     * Update the progress of a topic
-
 
669
     * @param int $user_id
661
     * @param int $user_id
670
     * @param int $company_id
662
     * @param int $slide_id
671
     * @param int $slide_id
663
     * @param int $capsule_id
672
     * @param int $capsule_id
664
     * @param int $topic_id
673
     * @param int $topic_id
665
     * @return void
674
     * @return void
666
     */
675
     */
667
    public function updateTopicProgress($user_id, $slide_id, $capsule_id, $topic_id){
676
    public function updateTopicProgress($user_id, $company_id, $slide_id, $capsule_id, $topic_id){
668
        // Get all capsules in the topic
677
        // Get all capsules in the topic
Línea 669... Línea 678...
669
        $totalCapsules = $this->topicCapsuleMapper->fetchTotalCountByTopicId($topic_id);
678
        $totalCapsules = $this->topicCapsuleMapper->fetchTotalCountByTopicId($topic_id);
670
 
679
 
Línea 678... Línea 687...
678
 
687
 
679
        $userProgress = $this->fetchOneByUserIdAndTopicId($user_id, $topic_id);
688
        $userProgress = $this->fetchOneByUserIdAndTopicId($user_id, $topic_id);
680
        if(!$userProgress){
689
        if(!$userProgress){
681
            $userProgress = new MicrolearningUserProgress();
690
            $userProgress = new MicrolearningUserProgress();
-
 
691
            $userProgress->user_id = $user_id;
682
            $userProgress->user_id = $user_id;
692
            $userProgress->company_id = $company_id;
683
            $userProgress->slide_id = $slide_id;
693
            $userProgress->slide_id = $slide_id;
684
            $userProgress->capsule_id = $capsule_id;
694
            $userProgress->capsule_id = $capsule_id;
685
            $userProgress->topic_id = $topic_id;
695
            $userProgress->topic_id = $topic_id;
686
            $userProgress->type = MicrolearningUserProgress::TYPE_TOPIC;
696
            $userProgress->type = MicrolearningUserProgress::TYPE_TOPIC;