Ejemplo n.º 1
0
    /**
     * create a admin category
     * @param  string $args['name']        name of the category
     * @param  string $args['description'] description of the category
     * @return mixed  admin category ID on success, false on failure
     */
    public function create($args)
    {
        // Argument check
        if (!isset($args['name']) || !strlen($args['name']) ||
            !isset($args['description'])) {
            return LogUtil::registerArgsError();
        }

        $args['sortorder'] = ModUtil::apiFunc('Admin', 'admin', 'countitems');

        $item = new Admin_Entity_AdminCategory();
        $item->merge($args);
        $this->entityManager->persist($item);
        $this->entityManager->flush();

        // Return the id of the newly created item to the calling process
        return $item['cid'];
    }
Ejemplo n.º 2
0
    /**
     * create the default data for the modules module
     *
     * This function is only ever called once during the lifetime of a particular
     * module instance
     *
     * @return bool false
     */
    public function defaultdata()
    {
        $records = array(
                    array('name'     => $this->__('System'),
                          'description' => $this->__('Core modules at the heart of operation of the site.')),
                    array('name'     => $this->__('Layout'),
                          'description' => $this->__("Layout modules for controlling the site's look and feel.")),
                    array('name'     => $this->__('Users'),
                          'description' => $this->__('Modules for controlling user membership, access rights and profiles.')),
                    array('name'     => $this->__('Content'),
                          'description' => $this->__('Modules for providing content to your users.')),
                    array('name'     => $this->__('Uncategorised'),
                          'description' => $this->__('Newly-installed or uncategorized modules.')),
                    array('name'     => $this->__('Security'),
                          'description' => $this->__('Modules for managing the site\'s security.')));

        foreach ($records as $record) {
            $item = new Admin_Entity_AdminCategory;
            $item->merge($record);
            $this->entityManager->persist($item);
        }

        $this->entityManager->flush();
    }