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


PHP Forms::getFieldsByBusinessId方法代码示例

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


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

示例1: getFields

 public function getFields($business_id)
 {
     $fields = array();
     $res = Forms::getFieldsByBusinessId($business_id);
     foreach ($res as $count => $data) {
         $field_data = unserialize($data->field_data);
         $fields[$data->form_id] = array('field_type' => $data->field_type, 'label' => $field_data['label'], 'options' => array_key_exists('options', $field_data) ? unserialize($field_data['options']) : array(), 'value_a' => array_key_exists('value_a', $field_data) ? $field_data['value_a'] : '', 'value_b' => array_key_exists('value_b', $field_data) ? $field_data['value_b'] : '');
     }
     return $fields;
 }
开发者ID:reminisense,项目名称:featherq-laravel5,代码行数:10,代码来源:FormsController.php

示例2: postSendtoBusiness

 public function postSendtoBusiness()
 {
     if (Auth::check()) {
         $business_id = Input::get('business_id');
         $attachment = Input::get('contfile');
         $email = User::email(Auth::user()->user_id);
         $timestamp = time();
         $thread_key = $this->threadKeyGenerator($business_id, $email);
         $custom_fields_bool = Input::get('custom_fields_bool');
         // save if there are custom fields available
         $custom_fields_data = '';
         if ($custom_fields_bool) {
             $custom_fields = Input::get('custom_fields');
             $res = Forms::getFieldsByBusinessId($business_id);
             foreach ($res as $count => $data) {
                 $custom_fields_data .= '<strong>' . Forms::getLabelByFormId($data->form_id) . ':</strong> ' . $custom_fields[$data->form_id] . "\n";
             }
         }
         if (!Message::checkThreadByKey($thread_key)) {
             $phones[] = Input::get('contmobile');
             Message::createThread(array('contactname' => User::first_name(Auth::user()->user_id) . ' ' . User::last_name(Auth::user()->user_id), 'business_id' => $business_id, 'email' => $email, 'phone' => serialize($phones), 'thread_key' => $thread_key));
             $data = json_encode(array(array('timestamp' => $timestamp, 'contmessage' => Input::get('contmessage') . "\n\n" . $custom_fields_data, 'attachment' => $attachment, 'sender' => 'user')));
             file_put_contents(public_path() . '/json/messages/' . $thread_key . '.json', $data);
         } else {
             $data = json_decode(file_get_contents(public_path() . '/json/messages/' . $thread_key . '.json'));
             $data[] = array('timestamp' => $timestamp, 'contmessage' => Input::get('contmessage') . "\n\n" . $custom_fields_data, 'attachment' => $attachment, 'sender' => 'user');
             $data = json_encode($data);
             file_put_contents(public_path() . '/json/messages/' . $thread_key . '.json', $data);
         }
         /*
         Mail::send('emails.contact', array(
           'name' => $name,
           'email' => $email,
           'messageContent' => Input::get('contmessage') . "\n\nAttachment: " . $attachment . "\n\n" . $custom_fields_data,
         ), function($message, $email, $name)
         {
           $message->subject('Message from '. $name . ' ' . $email);
           $message->to('paul@reminisense.com');
         });
         */
         return json_encode(array('status' => 1));
     } else {
         return json_encode(array('messages' => 'You are not allowed to access this function.'));
     }
 }
开发者ID:reminisense,项目名称:featherq-laravel5,代码行数:45,代码来源:MessageController.php


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