system.php 1.63 KB
<?php
class Flora_Api_Service_System extends Flora_Api_Service
{
    const API_LANGUAGES_BYID = "system/language";
    const API_LANGUAGES_LIST = "system/languages";
    const API_PAGE_BYID = "system/page";
    const API_SNIPPET_BYID = "system/snippet";
    const API_PAGES_LIST = "system/pages";
    const API_IP_INFO = "system/ipinfo";
    const API_FEEDBACK = "system/feedback";

    /**
     * @param $id
     * @return Flora_Model_Language
     */
    public function getLanguageById($id)
    {
        return $this->call(self::API_LANGUAGES_BYID, array("id" => $id));
    }

    /**
     * @return Flora_Collection|Flora_Model_Language[]
     */
    public function getLanguagesList()
    {
        return $this->call(self::API_LANGUAGES_LIST);
    }

    /**
     * @param $id
     * @return Flora_Model_Page
     */
    public function getPageById($id)
    {
        return $this->call(self::API_PAGE_BYID, array("id" => $id));
    }

    /**
     * @param $id
     * @return Flora_Model_Snippet
     */
    public function getSnippetById($id)
    {
        return $this->call(self::API_SNIPPET_BYID, array("id" => $id));
    }

    /**
     * @param $category
     * @return Flora_Model_Page[]|Flora_Collection
     */
    public function getPagesList($category = '')
    {
        return $this->call(self::API_PAGES_LIST, array("category" => $category));
    }

    /**
     * @return stdClass
     */
    public function getIPInfo()
    {
        return $this->call(self::API_IP_INFO);
    }

    public function sendFeedback($email, $text)
    {
        return $this->call(self::API_FEEDBACK, array(), array('email' => $email, 'text' => $text));
    }
}