Proyectos de Subversion LeadersLinked - Services

Rev

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

Rev 636 Rev 652
Línea 553... Línea 553...
553
        
553
        
Línea 554... Línea 554...
554
    }
554
    }
555
    
555
    
556
    public function markSlideViewed($user_id, $topic_id, $capsule_id, $slide_id)
-
 
557
    {
-
 
558
        $data = [
-
 
559
            'user_id'    => $user_id,
-
 
560
            'topic_id'   => $topic_id,
-
 
561
            'capsule_id' => $capsule_id,
-
 
562
            'slide_id'   => $slide_id,
-
 
563
            'viewed_at'  => date('Y-m-d H:i:s'),
-
 
564
        ];
556
    public function markSlideViewed($user_id, $topic_id, $capsule_id, $slide_id)
565
 
557
    {
566
        // Verifica si ya existe el registro
558
        // Verifica si ya existe el registro
567
        $exists = $this->fetchOneByUserIdAndSlideId($user_id, $slide_id);
559
        $exists = $this->fetchOneByUserIdAndSlideId($user_id, $slide_id);
568
        if ($exists) {
560
        if ($exists) {
Línea -... Línea 561...
-
 
561
            return; // ya registrado
-
 
562
        }
-
 
563
 
-
 
564
        $now = $this->getDatebaseNow();
-
 
565
        $userProgress = new \LeadersLinked\Model\MicrolearningUserProgress();
-
 
566
        $userProgress->user_id = $user_id;
-
 
567
        $userProgress->topic_id = $topic_id;
-
 
568
        $userProgress->capsule_id = $capsule_id;
-
 
569
        $userProgress->slide_id = $slide_id;
-
 
570
        $userProgress->type = MicrolearningUserProgress::TYPE_SLIDE;
-
 
571
        $userProgress->progress = 100;
-
 
572
        $userProgress->completed = 1;
-
 
573
        $userProgress->returning = 0;
-
 
574
        $userProgress->returning_after_completed = 0; // Regr
-
 
575
        $userProgress->total_slides = 0;
-
 
576
        $userProgress->view_slides = 0;
569
            return; // ya registrado
577
        $userProgress->added_on = $now;
570
        }
578
        $userProgress->updated_on = $now;
Línea 571... Línea 579...
571
 
579
 
572
        return $this->insert($data);
580
        return $this->insert($userProgress);
573
    }
-
 
574
 
-
 
575
    public function markCapsuleCompleted($user_id, $topic_id, $capsule_id)
-
 
576
    {
-
 
577
        $data = [
-
 
578
            'user_id'       => $user_id,
-
 
579
            'topic_id'      => $topic_id,
-
 
580
            'capsule_id'    => $capsule_id,
581
    }
581
            'completed_at'  => date('Y-m-d H:i:s'),
582
 
582
        ];
583
    public function markCapsuleCompleted($user_id, $topic_id, $capsule_id)
583
 
584
    {
584
        // Verifica si ya existe algún progreso de cápsula
585
        // Verifica si ya existe algún progreso de cápsula
Línea -... Línea 586...
-
 
586
        $exists = $this->fetchOneByUseridAndCapsuleId($user_id, $capsule_id);
-
 
587
        if ($exists) {
-
 
588
            return; // ya registrado
-
 
589
        }
-
 
590
 
-
 
591
        $now = $this->getDatebaseNow();
-
 
592
        $userProgress = new \LeadersLinked\Model\MicrolearningUserProgress();
-
 
593
        $userProgress->user_id = $user_id;
-
 
594
        $userProgress->topic_id = $topic_id;
-
 
595
        $userProgress->capsule_id = $capsule_id;
-
 
596
        $userProgress->type = \LeadersLinked\Model\MicrolearningUserProgress::TYPE_CAPSULE;
-
 
597
        $userProgress->progress = 100;
-
 
598
        $userProgress->completed = 1;
-
 
599
        $userProgress->returning = 0;
-
 
600
        $userProgress->returning_after_completed = 0;
585
        $exists = $this->fetchOneByUserIdAndCapsuleId($user_id, $capsule_id);
601
        $userProgress->total_slides = 0;
586
        if ($exists) {
602
        $userProgress->view_slides = 0;
Línea 587... Línea 603...
587
            return; // ya registrado
603
        $userProgress->added_on = $now;
588
        }
604
        $userProgress->updated_on = $now;
589
 
-
 
590
        return $this->insert($data);
-
 
591
    }
-
 
592
 
-
 
593
    public function markTopicCompleted($user_id, $topic_id)
-
 
594
    {
-
 
595
        $data = [
-
 
596
            'user_id'      => $user_id,
605
 
597
            'topic_id'     => $topic_id,
606
        return $this->insert($userProgress);
598
            'topic_closed' => 1,
607
    }
599
            'closed_at'    => date('Y-m-d H:i:s'),
608
 
600
        ];
609
    public function markTopicCompleted($user_id, $topic_id)
Línea -... Línea 610...
-
 
610
    {
-
 
611
        // Verifica si ya existe algún progreso de topic
-
 
612
        $exists = $this->fetchOneByUserIdAndTopicId($user_id, $topic_id);
-
 
613
        if ($exists) {
-
 
614
            return; // ya registrado
-
 
615
        }
-
 
616
 
-
 
617
        $now = $this->getDatebaseNow();
-
 
618
        $userProgress = new \LeadersLinked\Model\MicrolearningUserProgress();
-
 
619
        $userProgress->user_id = $user_id;
-
 
620
        $userProgress->topic_id = $topic_id;
-
 
621
        $userProgress->type = \LeadersLinked\Model\MicrolearningUserProgress::TYPE_TOPIC;
-
 
622
        $userProgress->progress = 100;
-
 
623
        $userProgress->completed = 1;
601
 
624
        $userProgress->returning = 0;
602
        // Verifica si ya existe algún progreso de topic
625
        $userProgress->returning_after_completed = 0;
Línea 603... Línea 626...
603
        $exists = $this->fetchOneByUserIdAndTopicId($user_id, $topic_id);
626
        $userProgress->total_slides = 0;
604
        if ($exists) {
627
        $userProgress->view_slides = 0;
605
            return; // ya registrado
628
        $userProgress->added_on = $now;