Example #1
0
    protected function populate()
    {
        parent::populate();

        $parser = new MMSynchArticleCoreContentParser($this->source['q_question'], $this);
        $this->content->fields->question      = $parser->getRichContent();
        $this->content->fields->points        = $this->source['q_points'];
        $this->content->fields->correct_reply = $this->source['q_correct_reply'];

        $replies = json_decode($this->source['q_replies']);
        if(is_array($replies))
        {
            $matrixDataText = '';
			foreach($replies as $count => $r)
            {
                if($count > 0)
                    $matrixDataText .= '&';
                    $r->label = str_replace('&', '__', $r->label);
                    $r->label = str_replace('|', '##', $r->label);
				$matrixDataText .= $r->index . '|' . $r->label;
            }
			$this->content->fields->replies = $matrixDataText;
		}

        $parser = new MMSynchArticleCoreContentParser($this->source['q_commented_answer'], $this);
        $this->content->fields->commented_answer = $parser->getRichContent();
    }
Example #2
0
    protected function populate()
    {
        parent::populate();

        $fileOrLinkPopulated = false;
        if (!empty($this->source['m_file']))
        {
            $this->file = MMSynchFileManager::fromRoot($this->getPublisher(), MMSynchFileManager::PDF_FOLDER, $this->source['m_file']);
            $this->content->fields->file = $this->file->getFullPath();
            $fileOrLinkPopulated = true;
        }
        if (!empty($this->source['pdf_link']))
        {
            $this->content->fields->link = $this->source['pdf_link'];
            $fileOrLinkPopulated = true;
        }

        if (!$fileOrLinkPopulated)
        {
            throw new MMSynchException("Either file or link should be populated for PDF file.");
        }
        $this->content->fields->source              = $this->source['pdf_source'];
        $this->content->fields->expiration_duration = $this->source['pdf_expiration_duration'];
        $this->content->fields->media_target        = $this->source['pdf_media_target'];
        $this->content->fields->link                = $this->source['pdf_link'];
    }
Example #3
0
    protected function populate()
    {
        parent::populate();

        $this->file                  = MMSynchFileManager::fromRoot($this->getPublisher(), MMSynchFileManager::FILE_FOLDER, $this->source['m_file']);
        $this->content->fields->file = $this->file->getFullPath();
        $this->content->fields->media_target        = $this->source['file_media_target'];
    }
Example #4
0
    protected function populate()
    {
        parent::populate();

        $this->file                             = MMSynchFileManager::fromRoot($this->getPublisher(), MMSynchFileManager::AUDIO_FOLDER, $this->source['m_file']);
        $this->content->fields->file            = sprintf('%s||%s', $this->file->getFullPath(), $this->getPublisher()->getFolder());
        $this->content->fields->screen_capture  = MMSynchHelper::binaryToFile($this->source['audio_screen_capture']);
        $this->content->fields->duration        = $this->source['audio_duration'];
    }
Example #5
0
    protected function populate()
    {
        parent::populate();

        $this->file                             = MMSynchFileManager::fromRoot($this->getPublisher(), MMSynchFileManager::IMAGE_FOLDER, $this->source['m_file']);
        $this->content->fields->file            = $this->file->getFullPath();
        $this->content->fields->original_size   = $this->source['i_original_size'];
        $this->content->fields->alternate_text  = $this->source['i_alternate_text'];
    }
Example #6
0
    protected function populate()
    {
        parent::populate();

        $id = false;
        if ($this->source['video_brightcoveid'] != '')
        {
            $id = $this->source['video_brightcoveid'];
        }

        $filepath = false;
        if ($this->source['m_file'])
        {
            try
            {
                $this->file = MMSynchFileManager::fromRoot($this->getPublisher(), MMSynchFileManager::VIDEO_FOLDER, $this->source['m_file']);
                $filepath = $this->file->getFullPath();
            }
            catch(Exception $e)
            {
                if ($id)
                {
                    MMSynchLog::warning($this, $e->getMessage());
                }
                else
                {
                    throw MMSynchException::fromException($e);
                }
            }
        }

        $this->content->fields->file            = sprintf('%s|%s|%s', $filepath, $id, $this->getPublisher()->getFolder());
        $this->content->fields->screen_capture  = MMSynchHelper::binaryToFile($this->source['video_screen_capture']);
        $this->content->fields->duration        = $this->source['video_duration'];
        $this->content->fields->original_size   = $this->source['video_original_size'];
    }
Example #7
0
 protected function populate()
 {
     parent::populate();
     $this->content->fields->url = $this->source['link_url'];
 }