Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Apps Configuration

Requires: phpFox 4.5+

...

Code Block
languagephp
themeRDark
borderStylesolid
linenumberstrue
collapsetrue
<?php

namespace Apps\TodoList;

use Core\App;

class Install extends App\App
{
    private $_app_phrases = [];

    protected function setId()
    {
        //Set ID for your app. This action is required.
        $this->id = 'TodoList';
    }
    protected function setSupportVersion()
    {
        //Start support version
        $this->start_support_version = '4.5.0';
    }

    protected function setAlias()
    {
        //Set alias for your app
        $this->alias = 'todo';
    }

    protected function setName()
    {
        //Set Name for your app, this name will display in manage apps (admincp)
        $this->name = 'TodoList';
    }

    protected function setVersion()
    {
        //Set version for your app
        $this->version = '4.1.2';
    }

    protected function setSettings()
    {
        //Define settings for your app
        $this->settings = [
            'td_can_user_privacy' => [
                'var_name' => 'td_can_user_privacy',
                'info' => 'Allow user add privacy',
                'description' => 'Enable this setting in case you want your user can use privacy during adding new todo list',
                'type' => 'boolean',
                'value' => '1',
            ],
            'td_feature_price' => [
                'var_name' => 'td_feature_price',
                'info' => 'How much does it cost to feature a todo list?',
                'type' => 'currency',
                'value' => serialize(['USD' => 1, 'EUR' => 1, 'GBP' => 1])
            ]
        ];
    }

    protected function setUserGroupSettings()
    {
        //Define user group settings for your app
        $this->user_group_settings = [
            'td_can_add_new_todo_list' => [
                'var_name' => 'td_can_add_new_todo_list',
                'info' => 'Can add new todo list?',
                'type' => 'boolean',
                'value' => [
                    "1" => "1",
                    "2" => "1",
                    "3" => "1",
                    "4" => "1",
                    "5" => "0"
                ],
                'ordering' => 1,
            ],
            'can_sponsor_todo' => [
                'info' => 'Can members of this user group mark a todo list as Sponsor without paying fee?',
                'type' => 'boolean',
                'value' => [
                    '1' => '1',
                    '2' => '0',
                    '3' => '0',
                    '4' => '0',
                    '5' => '0'
                ],
                'ordering' => 1,
            ],
            'todo_sponsor_price' => [
                'var_name' => 'td_user_sponsor_price',
                'info' => 'How much does it cost to sponsor a todo list',
                'type' => 'currency',
                'value' => [
                    '1' => ['USD' => 1],
                    '2' => ['USD' => 2],
                    '3' => ['USD' => 3],
                    '4' => ['USD' => 4],
                    '5' => ['USD' => 5],
                ],
            ],
            'auto_publish_sponsored_todo' => [
                'info' => 'Auto publish sponsored todo list?',
                'description' => 'After the user has purchased a sponsored space, should the todo list be published right away? If set to No, the admin will have to approve each new purchased sponsored todo list space before it is shown in the site.',
                'type' => 'boolean',
                'value' => [
                    '1' => '1',
                    '2' => '0',
                    '3' => '0',
                    '4' => '0',
                    '5' => '0'
                ],
            ],
        ];
    }

    protected function setComponent()
    {
        //Define component for your app
        $this->component = [
            "block" => [
                "recent_items" => "",
            ],
            "controller" => [
                "index" => "todo.index",
            ]
        ];
    }

    protected function setComponentBlock()
    {
        //Define component block for your app
        $this->component_block = [
            "Recent Items" => [
                "type_id"      => "0",
                "m_connection" => "todo.index",
                "component"    => "recent_items",
                "location"     => "3",
                "is_active"    => "1",
                "ordering"     => "1"
            ],
        ];
    }

    protected function setPhrase()
    {
        //Add more phrase for your app. However, for mow please define in phrase.json
        $this->phrase = $this->_app_phrases;
    }

    protected function setOthers()
    {
        //Default page of your app in AdminCP
        $this->admincp_route = {your_admincp_route};

        //Set action menu to your app in AdminCP
        $this->admincp_action_menu = [
            '{your_action_menu_link}' => {your_action_menu_name}
        ];

        //Set default menu when view app detail in AdminCP
        $this->admincp_menu = [
            'Manage To Do' => 'todo', // 'todo' is your app's alias
        ];

        //Add your app menu into main menu in frontend
        $this->menu = [
            "name" => "To Do List",  // Menu label
            "url" => "/to-do-list", // Menu Url
            "icon" => "tasks"      // Menu icons, see http://fontawesome.io/icons/
        ];

        //Your company name
        $this->_publisher = 'phpFox';

        //Your company website
        $this->_publisher_url = 'http://store.phpfox.com/';

        //Include your external paths
        $this->external_paths = [
            [
                'path' => 'PF.Base/example_folder'
                'removeable => true
            ],
            [
                'path' => 'PF.Base/example_file'
                'removeable => false
            ]
        ];

        //Include database class name
        $this->database = [
            'TodoTaskTable'
        ];
    }
}

...