Exemplo n.º 1
0
    function _getFormMask($p_admin)
    {
        global $g_user;

        $data = $this->getData();

        foreach ($data as $k => $v) {
            // clean user input
            if (!in_array($k, self::$m_html_allowed_fields)) {
                $data[$k] = camp_html_entity_decode_array($v);
            }
        }

        $languageSelectedObj = new Language($data['fk_language_id']);
        $editorLanguage = !empty($_COOKIE['TOL_Language']) ? $_COOKIE['TOL_Language'] : $languageSelectedObj->getCode();


        $mask = array(
            'f_entry_id'    => array(
                'element'   => 'f_entry_id',
                'type'      => 'hidden',
                'constant'  => $data['entry_id']
            ),
            SecurityToken::SECURITY_TOKEN => array(
            	'element'   => SecurityToken::SECURITY_TOKEN,
            	'type'      => 'hidden',
            	'constant'  => SecurityToken::GetToken()
            ),
            'f_blog_id'    => array(
                'element'   => 'f_blog_id',
                'type'      => 'hidden',
                'constant'  => $data['fk_blog_id']
            ),
            'tiny_mce'  => array(
                'element'   => 'tiny_mce',
                'text'      => Blog::GetEditor('tiny_mce_box', $g_user, $editorLanguage),
                'type'  => 'static'
            ),
            'title'     => array(
                'element'   => 'BlogEntry[title]',
                'type'      => 'text',
                'label'     => getGS('Title'),
                'default'   => $data['title'],
                'required'  => true
            ),
            'content'      => array(
                'element'   => 'BlogEntry[content]',
                'type'      => 'textarea',
                'label'     => getGS('Content'),
                'default'   => $data['content'],
                'required'  => true,
                'attributes'=> array('cols' => 86, 'rows' => 16, 'id' => 'tiny_mce_box', 'class' => 'tinymce')
            ),
            'status' => array(
                'element'   => 'BlogEntry[status]',
                'type'      => 'select',
                'label'     => getGS('Status'),
                'default'   => $data['status'],
                'options'   => array(
                    'online'    => 'online',
                    'offline'   => 'offline'
                ),
                'required'  => true
            ),
            'admin_status' => array(
                'element'   => 'BlogEntry[admin_status]',
                'type'      => 'select',
                'label'     => getGS('Admin status'),
                'default'   => $data['admin_status'],
                'options'   => array(
                    'online'    => 'online',
                    'offline'   => 'offline',
                    'pending'   => 'pending',
                ),
                'required'  => true
            ),
            'mood'      => array(
                'element'   => 'BlogEntry[fk_mood_id]',
                'type'      => 'select',
                'label'     => getGS('Mood'),
                'default'   => $data['fk_mood_id'],
                'options'   => Blog::GetMoodList(!empty($data['fk_laguage_id']) ? $data['fk_laguage_id'] : Blog::GetBlogLanguageId($data['fk_blog_id']))
            ),
            'image'     => array(
                'element'   => 'BlogEntry_Image',
                'type'      => 'file',
                'label'     => getGS('Image (.jpg, .png, .gif)'),
            ),
            'image_display'  => array(
                'element'   => 'image_display',
                'text'      => '<img src="'.$data['images']['100x100'].'">',
                'type'  => 'static',
                'groupit'   => true
            ),
            'image_remove' => array(
                'element'   => 'BlogEntry_Image_remove',
                'type'      => 'checkbox',
                'label'     => getGS('Remove this Image'),
                'groupit'   => true
            ),
            'image_label'  => array(
                'element'   => 'image_label',
                'text'      => getGS('Remove this image'),
                'type'      => 'static',
                'groupit'   => true
            ),
            'image_group' =>  isset($data['images']['100x100']) ? array(
                'group'     => array('image_display', 'BlogEntry_Image_remove', 'image_label'),

            ) : null,
            'reset'     => array(
                'element'   => 'reset',
                'type'      => 'reset',
                'label'     => getGS('Reset'),
                'groupit'   => true
            ),
            'xsubmit'     => array(
                'element'   => 'xsubmit',
                'type'      => 'button',
                'label'     => getGS('Submit'),
                'attributes'=> array('onclick' => 'tinyMCE.triggerSave(); if (this.form.onsubmit()) this.form.submit()'),
                'groupit'   => true
            ),
            'cancel'     => array(
                'element'   => 'cancel',
                'type'      => 'button',
                'label'     => getGS('Cancel'),
                'attributes' => array('onClick' => 'window.close()'),
                'groupit'   => true
            ),
            'buttons'   => array(
                'group'     => array('cancel', 'reset', 'xsubmit')
            )
        );

        return $mask;
    }
Exemplo n.º 2
0
    private function getFormMask($p_owner=false, $p_admin=false)
    {
        global $g_user;

        $data = $this->getData();

        foreach (User::GetUsers() as $User) {
            if (1 || $User->hasPermission('PLUGIN_BLOG_USER')) {
                $ownerList[$User->getUserId()] = "{$User->getRealName()} ({$User->getUserName()})";
            }
        }
        asort($ownerList);

        $languageList = array('' => getGS("---Select language---"));
        foreach (Language::GetLanguages() as $Language) {
            $languageList[$Language->getLanguageId()] = $Language->getNativeName();
        }
        asort($languageList);

        foreach ($data as $k => $v) {
            // clean user input
            if (!in_array($k, self::$m_html_allowed_fields)) {
                $data[$k] = camp_html_entity_decode_array($v);
            }
        }

        // load possible topic list
        foreach ($this->GetTopicTreeFlat() as $topicId => $topicName) {
            $topics[$topicId]  = $topicName;
        }

        // get the topics used
        foreach ($this->getTopics() as $Topic) {
            $active_topics[$Topic->getTopicId()] = $Topic->getName($this->getLanguageId());
        }

        $languageSelectedObj = new Language($data['fk_language_id']);
        $editorLanguage = !empty($_COOKIE['TOL_Language']) ? $_COOKIE['TOL_Language'] : $languageSelectedObj->getCode();

        $mask = array(
            'f_blog_id'    => array(
                'element'   => 'f_blog_id',
                'type'      => 'hidden',
                'constant'  => $data['blog_id']
            ),
            SecurityToken::SECURITY_TOKEN => array(
            	'element'   => SecurityToken::SECURITY_TOKEN,
            	'type'      => 'hidden',
            	'constant'  => SecurityToken::GetToken()
            ),
            'language' => array(
                    'element'   => 'Blog[fk_language_id]',
                    'type'      => 'select',
                    'label'     => getGS('Language'),
                    'default'   => $data['fk_language_id'],
                    'options'   => $languageList,
                    'required'  => true
            ),
            'title'     => array(
                'element'   => 'Blog[title]',
                'type'      => 'text',
                'label'     => getGS('Title'),
                'default'   => $data['title'],
                'required'  => true
            ),
            'tiny_mce'  => array(
                'element'   => 'tiny_mce',
                'text'      => self::GetEditor('tiny_mce_box', $g_user, $editorLanguage),
                'type'      => 'static'
            ),
            'info'      => array(
                'element'   => 'Blog[info]',
                'type'      => 'textarea',
                'label'     => getGS('Info'),
                'default'   => $data['info'],
                'required'  => true,
                'attributes'=> array('cols' => 86, 'rows' => 16, 'id' => 'tiny_mce_box', 'class' => 'tinymce')
            ),
            'feature'     => array(
                'element'   => 'Blog[feature]',
                'type'      => 'text',
                'label'     => getGS('Feature'),
                'default'   => $data['feature'],
            ),
            'status' => array(
                'element'   => 'Blog[status]',
                'type'      => 'select',
                'label'     => getGS('Status'),
                'default'   => $data['status'],
                'required'  => true,
                'options'   => array(
                    'online'        => getGS('online'),
                    'offline'       => getGS('offline'),
                    'moderated'     => getGS('moderated'),
                    'readonly'      => getGS('read only'),
                ),

            ),
            'admin_status' => array(
                'element'   => 'Blog[admin_status]',
                'type'      => 'select',
                'label'     => getGS('Admin status'),
                'default'   => $data['admin_status'],
                'required'  => true,
                'options'   => array(
                    'online'        => getGS('online'),
                    'offline'       => getGS('offline'),
                    'pending'       => getGS('pending'),
                    'moderated'     => getGS('moderated'),
                    'readonly'      => getGS('read only'),
                ),
            ),
            'owner' => array(
                    'element'   => 'Blog[fk_user_id]',
                    'type'      => 'select',
                    'label'     => getGS('Owner'),
                    'default'   => $data['fk_user_id'],
                    'options'   => $ownerList,
            ),
            'image'     => array(
                'element'   => 'Blog_Image',
                'type'      => 'file',
                'label'     => getGS('Image (.jpg, .png, .gif)'),
            ),
            'image_display'  => array(
                'element'   => 'image_display',
                'text'      => '<img src="'.$data['images']['100x100'].'">',
                'type'  => 'static',
                'groupit'   => true
            ),
            'image_remove' => array(
                'element'   => 'Blog_Image_remove',
                'type'      => 'checkbox',
                'label'     => getGS('Remove this image'),
                'groupit'   => true
            ),
            'image_label'  => array(
                'element'   => 'image_label',
                'text'      => getGS('Remove this image'),
                'type'  => 'static',
                'groupit'   => true
            ),
            'image_group' =>  isset($data['images']['100x100']) ? array(
                'group'     => array('image_display', 'Blog_Image_remove', 'image_label'),

            ) : null,
            'admin_remark'      => array(
                'element'   => 'Blog[admin_remark]',
                'type'      => 'textarea',
                'label'     => getGS('Admin remark'),
                'default'   => $data['admin_remark'],
                'attributes'=> array('cols' => 86, 'rows' => 10)
            ),
            'reset'     => array(
                'element'   => 'reset',
                'type'      => 'reset',
                'label'     => getGS('Reset'),
                'groupit'   => true
            ),
            'xsubmit'     => array(
                'element'   => 'xsubmit',
                'type'      => 'button',
                'label'     => getGS('Submit'),
                'attributes'=> array('onclick' => 'tinyMCE.triggerSave(); if (this.form.onsubmit()) this.form.submit()'),
                'groupit'   => true
            ),
            'cancel'     => array(
                'element'   => 'cancel',
                'type'      => 'button',
                'label'     => getGS('Cancel'),
                'attributes' => array('onClick' => 'window.close()'),
                'groupit'   => true
            ),
            'buttons'   => array(
                'group'     => array('cancel', 'reset', 'xsubmit')
            )
        );

        return $mask;
    }