Ejemplo n.º 1
0
    public static function fetch($id)
    {
        $query = '
            SELECT %s, file.media_target as file_media_target
            FROM file as file
            WHERE file.id=%s;
        ';

        $result = self::synchronizer()->db->arrayQuery(sprintf($query, implode(', ', self::getQuerySelectFields('file')), $id));

        if (!is_array($result) || count($result) == 0)
        {
            throw new MMSynchException('File not found');
        }

        $content_row = parent::fetch($result[0]['m_content_id']);

        if (!$content_row)
            return false;

        $instance = new self(array_merge($content_row, $result[0]));

        MMSynchronizer::instance()->placeholder(array(__CLASS__, $id), $instance);

        return $instance;
    }
Ejemplo n.º 2
0
    public static function fetch($id)
    {
        $query = '
            SELECT %s, pdf.source as pdf_source, pdf.expiration_duration as pdf_expiration_duration, pdf.media_target as pdf_media_target, pdf.link as pdf_link
            FROM pdf as pdf
            WHERE pdf.id=%s;
        ';

        $result = self::synchronizer()->db->arrayQuery(sprintf($query, implode(', ', self::getQuerySelectFields('pdf')), $id));

        if (!is_array($result) || count($result) == 0)
        {
            throw new MMSynchException('PDF not found');
        }

        $content_row = parent::fetch($result[0]['m_content_id']);

        if (!$content_row)
            return false;

        $instance = new self(array_merge($content_row, $result[0]));

        MMSynchronizer::instance()->placeholder(array(__CLASS__, $id), $instance);

        return $instance;
    }
Ejemplo n.º 3
0
    public static function fetch($id)
    {
        $query = '
            SELECT %s, i.original_size as i_original_size, i.alternate_text as i_alternate_text
            FROM image as i
            WHERE i.id=%s;
        ';

        $result = self::synchronizer()->db->arrayQuery(sprintf($query, implode(', ', self::getQuerySelectFields('i')), $id));

        if ((!is_array($result) || count($result) == 0))
            return false;

        $content_row = parent::fetch($result[0]['m_content_id']);

        return new self(array_merge($content_row, $result[0]));
    }
Ejemplo n.º 4
0
    public static function fetch($id)
    {
        $query = '
            SELECT %s, link.url as link_url
            FROM link as link
            WHERE link.id=%s;
        ';

        $result = self::synchronizer()->db->arrayQuery(sprintf($query, implode(', ', self::getQuerySelectFields('link')), $id));

        if ((!is_array($result) || count($result) == 0))
        {
            throw new MMSynchException('Link not found');
        }

        $content_row = parent::fetch($result[0]['m_content_id']);

        return new self(array_merge($content_row, $result[0]));
    }
Ejemplo n.º 5
0
    public static function fetch($id, $origin=null)
    {
        self::$origin = $origin;

        $query = '
            SELECT %s, quiz.question as q_question, quiz.points as q_points, quiz.correct_reply as q_correct_reply, quiz.replies as q_replies, quiz.commented_answer as q_commented_answer
            FROM quiz as quiz
            WHERE quiz.id=%s;
        ';

        $result = self::synchronizer()->db->arrayQuery(sprintf($query, implode(', ', self::getQuerySelectFields('quiz')), $id));

        if((!is_array($result) || count($result) == 0))
            return false;

        $content_row = parent::fetch($result[0]['m_content_id']);

        return new self(array_merge($content_row, $result[0]));
    }
Ejemplo n.º 6
0
    public static function fetch($id)
    {
        $query = '
            SELECT %s,
                audio.duration as audio_duration,
                audio.screen_capture as audio_screen_capture
            FROM audio as audio
            WHERE audio.id=%s;
        ';

        $result = self::synchronizer()->db->arrayQuery(sprintf($query, implode(', ', self::getQuerySelectFields('audio')), $id));

        if ((!is_array($result) || count($result) == 0))
        {
            throw new MMSynchException('Audio not found');
        }

        $content_row = parent::fetch($result[0]['m_content_id']);

        return new self(array_merge($content_row, $result[0]));
    }
Ejemplo n.º 7
0
    public static function fetch($id)
    {
        $query = '
            SELECT %s,
                video.duration as video_duration,
                video.screen_capture as video_screen_capture,
                video.original_size as video_original_size,
                video.brightcoveid as video_brightcoveid
            FROM video as video
            WHERE video.id=%s;
        ';

        $result = self::synchronizer()->db->arrayQuery(sprintf($query, implode(', ', self::getQuerySelectFields('video')), $id));

        if ((!is_array($result) || count($result) == 0))
        {
            throw new MMSynchException('Video not found');
        }

        $content_row = parent::fetch($result[0]['m_content_id']);
        return new self(array_merge($content_row, $result[0]));
    }