Proyectos de Subversion LeadersLinked - Services

Rev

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

Rev 658 Rev 661
Línea 550... Línea 550...
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 $slide_id
553
     * @param int $slide_id
554
     * @param int $capsule_id
554
     * @param int $capsule_id
-
 
555
     * @param int $topic_id
555
     * @return int
556
     * @return int
556
     */
557
     */
557
    public function updateSlideProgress($user_id, $slide_id, $capsule_id){
558
    public function updateSlideProgress($user_id, $slide_id, $capsule_id, $topic_id){
558
        $userProgress = $this->fetchOneByUserIdAndSlideId($user_id, $slide_id);
559
        $userProgress = $this->fetchOneByUserIdAndSlideId($user_id, $slide_id);
559
        if(!$userProgress){
560
        if(!$userProgress){
560
            $userProgress = new MicrolearningUserProgress();
561
            $userProgress = new MicrolearningUserProgress();
561
            $userProgress->user_id = $user_id;
562
            $userProgress->user_id = $user_id;
562
            $userProgress->slide_id = $slide_id;
563
            $userProgress->slide_id = $slide_id;
563
            $userProgress->capsule_id = $capsule_id;
564
            $userProgress->capsule_id = $capsule_id;
-
 
565
            $userProgress->topic_id = $topic_id;
564
            $userProgress->type = MicrolearningUserProgress::TYPE_SLIDE;
566
            $userProgress->type = MicrolearningUserProgress::TYPE_SLIDE;
565
            $userProgress->progress = 100;
567
            $userProgress->progress = 100;
566
            $userProgress->completed = 1;
568
            $userProgress->completed = 1;
567
            $userProgress->added_on = date('Y-m-d H:i:s');
569
            $userProgress->added_on = date('Y-m-d H:i:s');
568
            $userProgress->updated_on = date('Y-m-d H:i:s');
570
            $userProgress->updated_on = date('Y-m-d H:i:s');
Línea 596... Línea 598...
596
    }
598
    }
Línea 597... Línea 599...
597
 
599
 
598
    /**
600
    /**
599
     * Update the progress of a capsule
601
     * Update the progress of a capsule
-
 
602
     * @param int $user_id
600
     * @param int $user_id
603
     * @param int $slide_id
601
     * @param int $capsule_id
604
     * @param int $capsule_id
602
     * @param int $topic_id
605
     * @param int $topic_id
603
     * @return int
606
     * @return int
604
     */
607
     */
605
    public function updateCapsuleProgress($user_id, $capsule_id, $topic_id){
608
    public function updateCapsuleProgress($user_id, $slide_id, $capsule_id, $topic_id){
606
        // Get total slides in the capsule
609
        // Get total slides in the capsule
Línea 607... Línea 610...
607
        $totalSlides = $this->slideMapper->fetchTotalCountByCapsuleId($capsule_id);
610
        $totalSlides = $this->slideMapper->fetchTotalCountByCapsuleId($capsule_id);
608
 
611
 
Línea 615... Línea 618...
615
 
618
 
616
        $userProgress = $this->fetchOneByUserIdAndCapsuleId($user_id, $capsule_id);
619
        $userProgress = $this->fetchOneByUserIdAndCapsuleId($user_id, $capsule_id);
617
        if(!$userProgress){
620
        if(!$userProgress){
618
            $userProgress = new MicrolearningUserProgress();
621
            $userProgress = new MicrolearningUserProgress();
-
 
622
            $userProgress->user_id = $user_id;
619
            $userProgress->user_id = $user_id;
623
            $userProgress->slide_id = $slide_id;
620
            $userProgress->capsule_id = $capsule_id;
624
            $userProgress->capsule_id = $capsule_id;
621
            $userProgress->topic_id = $topic_id;
625
            $userProgress->topic_id = $topic_id;
622
            $userProgress->type = MicrolearningUserProgress::TYPE_CAPSULE;
626
            $userProgress->type = MicrolearningUserProgress::TYPE_CAPSULE;
623
            $userProgress->progress = $progress;
627
            $userProgress->progress = $progress;
Línea 653... Línea 657...
653
    }
657
    }
Línea 654... Línea 658...
654
 
658
 
655
    /**
659
    /**
656
     * Update the progress of a topic
660
     * Update the progress of a topic
-
 
661
     * @param int $user_id
-
 
662
     * @param int $slide_id
657
     * @param int $user_id
663
     * @param int $capsule_id
658
     * @param int $topic_id
664
     * @param int $topic_id
659
     * @return void
665
     * @return void
660
     */
666
     */
661
    public function updateTopicProgress($user_id, $topic_id){
667
    public function updateTopicProgress($user_id, $slide_id, $capsule_id, $topic_id){
662
        // Get all capsules in the topic
668
        // Get all capsules in the topic
Línea 663... Línea 669...
663
        $totalCapsules = $this->topicCapsuleMapper->fetchTotalCountByTopicId($topic_id);
669
        $totalCapsules = $this->topicCapsuleMapper->fetchTotalCountByTopicId($topic_id);
664
 
670
 
Línea 672... Línea 678...
672
 
678
 
673
        $userProgress = $this->fetchOneByUserIdAndTopicId($user_id, $topic_id);
679
        $userProgress = $this->fetchOneByUserIdAndTopicId($user_id, $topic_id);
674
        if(!$userProgress){
680
        if(!$userProgress){
675
            $userProgress = new MicrolearningUserProgress();
681
            $userProgress = new MicrolearningUserProgress();
-
 
682
            $userProgress->user_id = $user_id;
-
 
683
            $userProgress->slide_id = $slide_id;
676
            $userProgress->user_id = $user_id;
684
            $userProgress->capsule_id = $capsule_id;
677
            $userProgress->topic_id = $topic_id;
685
            $userProgress->topic_id = $topic_id;
678
            $userProgress->type = MicrolearningUserProgress::TYPE_TOPIC;
686
            $userProgress->type = MicrolearningUserProgress::TYPE_TOPIC;
679
            $userProgress->progress = $progress;
687
            $userProgress->progress = $progress;
680
            $userProgress->completed = $completed;
688
            $userProgress->completed = $completed;