当前位置: 首页>>代码示例>>PHP>>正文


PHP FormProcessor::parseArr2Form方法代码示例

本文整理汇总了PHP中FormProcessor::parseArr2Form方法的典型用法代码示例。如果您正苦于以下问题:PHP FormProcessor::parseArr2Form方法的具体用法?PHP FormProcessor::parseArr2Form怎么用?PHP FormProcessor::parseArr2Form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FormProcessor的用法示例。


在下文中一共展示了FormProcessor::parseArr2Form方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store

    public function store($p_type='item')
    {
        require_once 'HTML/QuickForm.php';

        $mask = InterviewItem::getFormMask($p_type, $p_owner, $p_admin);
        $form = new html_QuickForm('interviewitem', 'post', $p_target, null, null, true);
        FormProcessor::parseArr2Form($form, $mask);

        if ($form->validate() && SecurityToken::isValid()) {
            $data = $form->getSubmitValues();
            if ($this->getId()==0) {
                $this->create($data['f_questioneer_user_id'], $data['f_question'], $data['f_status']);
                $this->setInterviewId($data['f_interview_id']);
                $this->setQuestioneerwId($data['fk_questioneer_user_id']);
            }
            if (strlen($data['f_question'])) {
                $this->setProperty('question', $data['f_question']);
            }
            if (strlen($data['f_answer'])) {
                $this->setProperty('answer', $data['f_answer']);
            }
            if (strlen($data['f_status'])) {
                $this->setProperty('status', $data['f_status']);
            }
            return true;
        }
        return false;
    }
开发者ID:nistormihai,项目名称:Newscoop,代码行数:28,代码来源:InterviewItem.php

示例2: storeInvitation

    public function storeInvitation()
    {
        require_once 'HTML/QuickForm.php';

        $mask = self::getInvitationFormMask();
        $form = new html_QuickForm('invitation', 'post', $p_target, null, null, true);
        FormProcessor::parseArr2Form($form, $mask);

        if ($form->validate() && SecurityToken::isValid()) {
            $data = $form->getSubmitValues();

            $data['f_invitation_template_guest'] = preg_replace_callback('/(%7B%7B.*%7D%7D)/u', create_function('$input', 'return urldecode($input[0]);'), $data['f_invitation_template_guest']);
            $data['f_invitation_template_guest'] = preg_replace_callback('/{{[^}]*}}/', create_function('$input', 'return html_entity_decode($input[0]);'), $data['f_invitation_template_guest']);
            $data['f_invitation_template_questioneer'] = preg_replace_callback('/(%7B%7B.*%7D%7D)/u', create_function('$input', 'return urldecode($input[0]);'), $data['f_invitation_template_questioneer']);
            $data['f_invitation_template_questioneer'] = preg_replace_callback('/{{[^}]*}}/', create_function('$input', 'return html_entity_decode($input[0]);'), $data['f_invitation_template_questioneer']);

            $this->setProperty('invitation_sender', $data['f_invitation_sender']);
            $this->setProperty('invitation_subject', $data['f_invitation_subject']);
            $this->setProperty('invitation_template_guest', $data['f_invitation_template_guest']);
            $this->setProperty('invitation_template_questioneer', $data['f_invitation_template_questioneer']);

            return true;
        }
    }
开发者ID:nistormihai,项目名称:Newscoop,代码行数:24,代码来源:Interview.php

示例3: store

    function store($p_admin, $p_user_id=null)
    {
        require_once 'HTML/QuickForm.php';

        $mask = $this->_getFormMask($p_admin);
        $form = new html_QuickForm('blog_entry', 'post', '', null, null, true);
        FormProcessor::parseArr2Form($form, $mask);

        if ($form->validate() && SecurityToken::isValid()){
            $data = $form->getSubmitValues(true);

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

            if ($data['f_entry_id']) {
                foreach ($data['BlogEntry'] as $k => $v) {
                    if (is_array($v)) {
                        foreach($v as $key => $value) {
                            if ($value) {
                                $string .= "$key, ";
                            }
                        }
                        $v = substr($string, 0, -2);
                        unset ($string);

                    }
                    $this->setProperty($k, $v);
                }

                if ($data['BlogEntry_Image_remove']) {
                   BlogImageHelper::RemoveImageDerivates('entry', $data['f_entry_id']);
                }
                if ($data['BlogEntry_Image']) {
                    BlogImageHelper::StoreImageDerivates('entry', $data['f_entry_id'], $data['BlogEntry_Image']);
                }

                Blog::TriggerCounters(self::GetBlogId($data['f_entry_id']));

                return true;

            } elseif ($this->create(
                            $data['f_blog_id'],
                            $p_user_id,
                            $data['BlogEntry']['title'],
                            $data['BlogEntry']['content'],
                            $data['f_mood_id'])) {

                // admin and owner can override status setting
                if ($data['BlogEntry']['status']) {
                    $this->setProperty('status', $data['BlogEntry']['status']);
                }
                if ($p_admin && $data['BlogEntry']['admin_status']) {
                    $this->setProperty('admin_status', $data['BlogEntry']['admin_status']);
                }

                if ($data['BlogEntry_Image']) {
                    BlogImageHelper::StoreImageDerivates('entry', $this->getProperty('entry_id'), $data['BlogEntry_Image']);
                }

                Blog::TriggerCounters($this->getProperty('fk_blog_id'));
                return true;
            }
        }
        return false;

    }
开发者ID:nistormihai,项目名称:Newscoop,代码行数:70,代码来源:BlogEntry.php

示例4: store

    function store($p_admin, $p_user_id=null)
    {
        require_once 'HTML/QuickForm.php';
        $mask = $this->getFormMask($p_admin);
        $form = new html_QuickForm('blog', 'post', '', null, null, true);
        FormProcessor::parseArr2Form($form, $mask);

        if ($form->validate() && SecurityToken::isValid()){
            $data = $form->getSubmitValues(true);

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

            if ($data['f_blog_id']) {
                foreach ($data['Blog'] as $k => $v) {
                    $this->setProperty($k, $v);
                }

                if ($data['Blog_Image_remove']) {
                    BlogImageHelper::RemoveImageDerivates('blog', $data['f_blog_id']);
                }
                if ($data['Blog_Image']) {
                    BlogImageHelper::StoreImageDerivates('blog', $data['f_blog_id'], $data['Blog_Image']);
                }

                return true;

            } elseif ($this->create(
                            isset($p_user_id) ? $p_user_id : $data['Blog']['fk_user_id'],
                            $data['Blog']['fk_language_id'],
                            $data['Blog']['title'],
                            $data['Blog']['info'],
                            $data['Blog']['request_text'],
                            $data['Blog']['feature'])) {

                if ($data['Blog']['status']) {
                    $this->setProperty('status', $data['Blog']['status']);
                }
                if ($p_admin && $data['Blog']['admin_status']) {
                    $this->setProperty('admin_status', $data['Blog']['admin_status']);
                }
                if ($p_admin && $data['Blog']['admin_remark']) {
                    $this->setProperty('admin_remark', $data['Blog']['admin_remark']);
                }
                if ($data['Blog_Image']) {
                    BlogImageHelper::StoreImageDerivates('blog', $this->getProperty('blog_id'), $data['BlogEntry_Image']);
                }

                return true;
            }
        }
        return false;

    }
开发者ID:nistormihai,项目名称:Newscoop,代码行数:58,代码来源:Blog.php


注:本文中的FormProcessor::parseArr2Form方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。