本文整理汇总了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;
}
示例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.'));
}
}