Loads the data required to render the plan_page template.

@param int $planid Learning Plan id.
@return boolean
331129
public static function data_for_plan_page($planid) {
        global $PAGE;
        $params = self::validate_parameters(self::data_for_plan_page_parameters(), array(
            'planid' => $planid
        ));
        $plan = api::read_plan($params['planid']);
        self::validate_context($plan->get_context());

        $renderable = new output\plan_page($plan);
        $renderer = $PAGE->get_renderer('tool_lp');

        $data = $renderable->export_for_template($renderer);

        return $data;
    }
23880
public function render_plans_page(plans_page $page) {
        $data = $page->export_for_template($this);
        return parent::render_from_template('tool_lp/plans_page', $data);
    }
709958
public function isPagesResourceId($resourceId)
    {
        $resources = explode('.', $resourceId);

        return ($this->isSitesResourceId($resourceId) && !empty($resources[2])
            && $resources[2] === self::RESOURCE_PAGES);
    }
34453
public function getPageLayout($pageId, $pageThemeId = null)
    {
        $sections = $templateSections = [];
        $error    = '';
        $details  = [];

        /** @var $pageModel \PageBuilder\Model\PageModel */
        $pageModel = $this->getServiceLocator()->get('pagebuilder\model\page');

        /** @var $themeModel \PageBuilder\Model\BaseModel */
        $themeModel = $this->getServiceLocator()->get('pagebuilder\model\theme');

        /** @var $templateModel \PageBuilder\Model\BaseModel */
        $templateModel = $this->getServiceLocator()->get('pagebuilder\model\template');

        /** @var $page \PageBuilder\Entity\Page */
        if ($page = $pageModel->getRepository()->find($pageId)) {

            $details = [
                'id'          => $page->getId(),
                'title'       => $page->getTitle(),
                'description' => $page->getDescription(),
                'template'    => $page->getTemplate() ? $page->getTemplate()->getTitle() : '',
                'layout'      => '',
                'pageTheme'   => '',
                'themeId'     => '',
                'layoutType'  => 'Custom Layout',
                'parent'      => $page->getParent() ? $page->getParent()->getTitle() : '',

            ];
        }
        $themeId = $pageTheme = null;
        if ($pageThemeId) {
            /** @var $pageThemeModel \PageBuilder\Model\BaseModel */
            $pageThemeModel = $this->getServiceLocator()->get('pagebuilder\model\pageTheme');
            $pageTheme      = $pageThemeModel->findObject($pageThemeId);
            $themeId        = $pageTheme->getId();
        }

        if ($themeId and $pageTheme) {
            $details['themeId'] = $themeId;

            $details['layout']    = $pageTheme->getLayout();
            $details['pageTheme'] = $pageTheme->getId();

            /** @var $temp \PageBuilder\Entity\Template */
            if ($temp = $page->getTemplate()) {
                $sections = $temp->getTemplateSections()->toArray();
            } elseif ($temp = $page->getParent()->getTemplate()) {
                $sections = $temp->getTemplateSections()->toArray();
            }
        }
        /** @var $section \PageBuilder\Entity\Join\TemplateSection */
        foreach ($sections as $section) {
            $slug                    = $section->getSectionId()->getSlug();
            $templateSections[$slug] = [
                'title'  => $section->getSectionId()->getTitle(),
                'status' => $section->getIsActive() ? 1 : 0,
                'class'  => $section->getIsActive() ? '' : 'in-active',
            ];
        }

        if ($themeData = $themeModel->getRepository()->findAll()) {
            /** @var $theme \PageBuilder\Entity\Theme */
            foreach ($themeData as $theme) {
                $details['themes'][$theme->getId()] = $theme->toArray();
            }
        } else {
            $details['themes'] = [];
        }

        /** @var $templateModel \PageBuilder\Model\TemplateModel */
        $templates  = $templateModel->listTemplates();
        $components = $this->getServiceLocator()->get('pagebuilder\model\component')->listItemsByTitle();

        /** @var $widgetUtil \PageBuilder\Util\Widget */
        $widgetUtil = $this->getServiceLocator()->get('util\widget');

        $widgetList = $widgetUtil->getWidgetList();
        $urlHelper  = $this->getServiceLocator()->get('ViewHelperManager')->get('url');

        $return = [
            'error'     => $error,
            'page'      => $details,
            'editUrl'   => $pageThemeId
                ? $urlHelper('builder\theme', ['id' => $pageThemeId])
                : $urlHelper(
                    'builder', ['id' => $pageId]
                ),
            'sections'  => $templateSections,
            'title'     => 'Layout Manager - ' . ($page ? $page->getTitle() : ''),
            'widgets'   => [
                'title' => 'Widgets',
                'items' => $widgetUtil->getRegistry(),
                'total' => count($widgetUtil->getRegistry()),
                'list'  => $widgetList,
                'id'    => PageBuilder::LAYOUT_WIDGET,
            ],
            'assets'    => [
                PageBuilder::LAYOUT_USER_DEFINED => [
                    'title' => 'User Defined',
                    'items' => $components,
                ],
            ],
            'templates' => [
                'title' => 'Templates',
                'items' => $templates,
            ],
            'tags'      => $this->_getTaglist(),
        ];

        return $return;
    }
367114
public static function user_competency_viewed_in_plan($competencyid, $userid, $planid) {
        $params = self::validate_parameters(self::user_competency_viewed_in_plan_parameters(), array(
            'competencyid' => $competencyid,
            'userid' => $userid,
            'planid' => $planid
        ));
        $pl = api::get_plan_competency($params['planid'], $params['competencyid']);
        $result = api::user_competency_viewed_in_plan($pl->usercompetency, $params['planid']);

        return $result;
    }
1025749
final public static function load_controller($restoreid = false) {
        // Get the restore id optional param.
        if ($restoreid) {
            try {
                // Try to load the controller with it.
                // If it fails at this point it is likely because this is the first load.
                $controller = restore_controller::load_controller($restoreid);
                return $controller;
            } catch (Exception $e) {
                return false;
            }
        }
        return $restoreid;
    }
936670
public function load($orderId)
    {
        $db = $this->getDb();
        $data = $db->getRow('SELECT * FROM `oepaypal_order` WHERE `oepaypal_orderid` = ' . $db->quote($orderId));

        return $data;
    }
1370419
public function loadFromFlexiBee($id = null)
    {
        $result = $this->adresar->loadFromFlexiBee($id);
        $this->takeData($this->adresar->getData());
        return $result;
    }
1323244
public static function plan_cancel_review_request($planorid) {
        static::require_enabled();
        $plan = $planorid;
        if (!is_object($plan)) {
            $plan = new plan($plan);
        }

        // We need to be able to view the plan at least.
        if (!$plan->can_read()) {
            throw new required_capability_exception($plan->get_context(), 'moodle/competency:planview', 'nopermissions', '');
        }

        if ($plan->is_based_on_template()) {
            throw new coding_exception('Template plans cannot be reviewed.');   // This should never happen.
        } else if ($plan->get('status') != plan::STATUS_WAITING_FOR_REVIEW) {
            throw new coding_exception('The plan review cannot be cancelled at this stage.');
        } else if (!$plan->can_request_review()) {
            throw new required_capability_exception($plan->get_context(), 'moodle/competency:planmanage', 'nopermissions', '');
        }

        $plan->set('status', plan::STATUS_DRAFT);
        $result = $plan->update();

        // Trigger review request cancelled event.
        \core\event\competency_plan_review_request_cancelled::create_from_plan($plan)->trigger();

        return $result;
    }
1259140
public function loadLayoutData($layoutId, int $status): array
    {
        $query = $this->getLayoutSelectQuery();
        $query->where(
            $query->expr()->eq('l.id', ':id')
        )
        ->setParameter('id', $layoutId, Type::INTEGER);

        $this->applyStatusCondition($query, $status, 'l.status');

        return $query->execute()->fetchAll(PDO::FETCH_ASSOC);
    }
381843
public function loadTemplate($tpl, $data = array(), $viewData = true)
    {
        $viewData && $data = $data + $this->viewData;
        if(substr_count($tpl,'::') ) {
            return view($tpl, $data);
        }
        return view('hstcms::manage.'.$tpl, $data);
    }
314538
private function load($id = null)
    {

        $this->initialize();
        $this->id = $id;
        $dataConnector = $this->getDataConnector();
        if (!is_null($dataConnector)) {
            return $dataConnector->loadUser($this);
        }

        return false;
    }
330083
public function loadUrlWildcardData($id)
    {
        /** @var $query \eZ\Publish\Core\Persistence\Database\SelectQuery */
        $query = $this->dbHandler->createSelectQuery();
        $query->select(
            '*'
        )->from(
            $this->dbHandler->quoteTable('ezurlwildcard')
        )->where(
            $query->expr->eq(
                $this->dbHandler->quoteColumn('id'),
                $query->bindValue($id, null, \PDO::PARAM_INT)
            )
        );
        $stmt = $query->prepare();
        $stmt->execute();

        return $stmt->fetch(\PDO::FETCH_ASSOC);
    }
548860
public function loadGroup($groupId)
    {
        $groups = $this->mapper->extractGroupsFromRows(
            $this->contentTypeGateway->loadGroupData([$groupId])
        );

        if (count($groups) !== 1) {
            throw new Exception\TypeGroupNotFound($groupId);
        }

        return $groups[0];
    }
761442
public static function remove_competency_from_plan($planid, $competencyid) {
        static::require_enabled();
        $plan = new plan($planid);

        // First we do a permissions check.
        if (!$plan->can_manage()) {
            $context = context_user::instance($plan->get('userid'));
            throw new required_capability_exception($context, 'moodle/competency:planmanage', 'nopermissions', '');

        } else if ($plan->is_based_on_template()) {
            throw new coding_exception('A competency can not be removed from a learning plan based on a template');
        }

        if (!$plan->can_be_edited()) {
            throw new coding_exception('A competency can not be removed from a learning plan completed');
        }

        $link = plan_competency::get_record(array('planid' => $planid, 'competencyid' => $competencyid));
        if ($link) {
            return $link->delete();
        }
        return false;
    }
1065548
public static function getByID($arLayoutID)
    {
        $db = Database::connection();
        $row = $db->GetRow('select arLayoutID, arLayoutIsPreset, arLayoutUsesThemeGridFramework from AreaLayouts where arLayoutID = ?', array($arLayoutID));
        if (is_array($row) && $row['arLayoutID']) {
            if ($row['arLayoutUsesThemeGridFramework']) {
                $al = new ThemeGridLayout();
            } elseif ($row['arLayoutIsPreset']) {
                $al = new PresetLayout();
            } else {
                $al = new CustomLayout();
            }
            $al->setPropertiesFromArray($row);
            $al->loadDetails();
            $al->loadColumnNumber();

            return $al;
        }
    }
806585
public static function add_competency_to_plan($planid, $competencyid) {
        static::require_enabled();
        $plan = new plan($planid);

        // First we do a permissions check.
        if (!$plan->can_manage()) {
            throw new required_capability_exception($plan->get_context(), 'moodle/competency:planmanage', 'nopermissions', '');

        } else if ($plan->is_based_on_template()) {
            throw new coding_exception('A competency can not be added to a learning plan based on a template');
        }

        if (!$plan->can_be_edited()) {
            throw new coding_exception('A competency can not be added to a learning plan completed');
        }

        $competency = new competency($competencyid);

        // Can not add a competency that belong to a hidden framework.
        if ($competency->get_framework()->get('visible') == false) {
            throw new coding_exception('A competency belonging to hidden framework can not be added');
        }

        $exists = plan_competency::get_record(array('planid' => $planid, 'competencyid' => $competencyid));
        if (!$exists) {
            $record = new stdClass();
            $record->planid = $planid;
            $record->competencyid = $competencyid;
            $plancompetency = new plan_competency(0, $record);
            $plancompetency->create();
        }

        return true;
    }