Skip to content
Snippets Groups Projects
Commit c9f678b7 authored by Eric Rasmussen's avatar Eric Rasmussen
Browse files

move mobile form stuff out of form plugin and into mobile_unl plugin

parent 43232288
Branches
No related tags found
No related merge requests found
Showing
with 0 additions and 1628 deletions
.river_object_form_data_create {
background: url(<?php echo $vars['url']; ?>_graphics/river_icons/river_icon_blog.gif) no-repeat left -1px;
}
.river_object_form_data_comment {
background: url(<?php echo $vars['url']; ?>_graphics/river_icons/river_icon_comment.gif) no-repeat left -1px;
}
.form_listing .search_listing {
border:2px solid #cccccc;
margin:0 0 5px 0;
}
#groups_info_column_left .tabberlive .tabbertab {
background-color: white;
}
#profile_info_column_middle .tabberlive .tabbertab {
background-color: white;
}
\ No newline at end of file
<?php
/**
* Default form data display
*
* @package form
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Kevin Jardine <kevin@radagast.biz>
* @copyright Radagast Solutions 2009
* @link http://radagast.biz/
*/
$form_data_id = $vars['entity']->getGUID();
$data = form_get_data($form_data_id);
$form = get_entity($vars['entity']->form_id);
$tab_data = form_get_tabbed_output_display($form,$data);
echo elgg_view('form/forms/display_form_content',array('tab_data'=>$tab_data,'description'=>'','preview'=>0,'form'=>$form,'form_data_id'=>0));
echo $vars['annotations'];
?>
\ No newline at end of file
<?php
/**
* Default form data listing
*
* @package form
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Kevin Jardine <kevin@radagast.biz>
* @copyright Radagast Solutions 2009
* @link http://radagast.biz/
*/
$owner = $vars['entity']->getOwnerEntity();
$friendlytime = friendly_time($vars['entity']->time_created);
$icon = elgg_view(
"profile/icon", array(
'entity' => $owner,
'size' => 'small',
)
);
$info = '<p><a href="'.$vars['entity']->getURL().'">'.elgg_echo('form:submission_to').'</a> "'.get_entity($vars['entity']->form_id)->title.'"</p>';
$info .= "<p class=\"owner_timestamp\"><a href=\"{$owner->getURL()}\">{$owner->name}</a> {$friendlytime}</p>";
echo elgg_view_listing($icon,$info.$vars['annotations']);
?>
\ No newline at end of file
<?php
/**
* Elgg field display
* Displays the specified Elgg title, field and description
*
* @package Elgg
* @subpackage Form
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Kevin Jardine <kevin@radagast.biz>
* @copyright Radagast Solutions 2008
* @link http://radagast.biz/
*/
$field = $vars['field'];
$title = $vars['title'];
$description = $vars['description'];
$body = <<<END
<label>$title<br />
$field
</label>
<p class="form-field-description">$description</p>
END;
print $body;
?>
\ No newline at end of file
<?php
/**
* Elgg display search form
*
* @package Form
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Kevin Jardine <kevin@radagast.biz>
* @copyright Radagast Solutions 2008
* @link http://radagast.biz/
*
*/
// load form model
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/models/model.php");
echo '<div class="contentWrapper">';
echo form_view_entities(array($vars['form_data']), $vars['form'], 'display');
echo '</div>';
?>
\ No newline at end of file
<?php
/**
* Elgg display search form
*
* @package Form
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Kevin Jardine <kevin@radagast.biz>
* @copyright Radagast Solutions 2008
* @link http://radagast.biz/
*
*/
// load form model
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/models/model.php");
$form = get_entity($vars['form_id']);
$fd = get_entity($vars['form_data_id']);
if (isset($_SESSION['last_search_qs'])) {
$qs = $_SERVER["QUERY_STRING"];
// remove the form data id from the query string first
$qsi = strpos($qs,'&');
$qs = substr($qs,$qsi+1);
$return_to_search_results = '<p><a href="'.$CONFIG->wwwroot.'mod/form/search_results.php?'.$qs
.'">'.elgg_echo('form:return_to_search_results').'</a></p>';
} else {
$return_to_search_results = '';
}
echo '<div class="contentWrapper">';
echo $return_to_search_results;
echo form_view_entities(array($fd), $form, 'display');
echo $return_to_search_results;
echo '</div>';
?>
\ No newline at end of file
<?php
$form = $vars['form'];
$display_bit = '<div class="tabbertab" title="'.elgg_echo('form:display_templates_tab_label').'">';
$display_bit .= '<label for="list_template">'.elgg_echo('form:list_template_label');
$display_bit .= elgg_view('input/longtext',array('internalname'=>'list_template','value'=>$form->list_template));
$display_bit .= '</label>';
$display_bit .= '<p class="description">'.elgg_echo('form:list_template_description').'</p>';
$display_bit .= '<label for="display_template">'.elgg_echo('form:display_template_label');
$display_bit .= elgg_view('input/longtext',array('internalname'=>'display_template','value'=>$form->display_template));
$display_bit .= '</label>';
$display_bit .= '<p class="description">'.elgg_echo('form:display_template_description').'</p>';
$display_bit .= '<input type="submit" name="submit" value="'.elgg_echo('form:form_manage_button').'">';
$display_bit .= '</div>';
echo $display_bit;
?>
\ No newline at end of file
<?php
// load form model
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/models/model.php");
$context = $vars['context'];
$offset = $vars['offset'];
$entities = $vars['entities'];
$form = $vars['form'];
$limit = $vars['limit'];
$count = $vars['count'];
$baseurl = $vars['baseurl'];
$context = $vars['context'];
$viewtype = $vars['viewtype'];
$html = "";
$nav = "";
if (isset($vars['viewtypetoggle'])) {
$viewtypetoggle = $vars['viewtypetoggle'];
} else {
$viewtypetoggle = true;
}
if ($context == "search" && $count > 0 && $viewtypetoggle) {
$nav .= elgg_view("navigation/viewtype",array(
'baseurl' => $baseurl,
'offset' => $offset,
'count' => $count,
'viewtype' => $viewtype,
));
}
$nav .= elgg_view('navigation/pagination',array(
'baseurl' => $baseurl,
'offset' => $offset,
'count' => $count,
'limit' => $limit,
));
$html .= $nav;
if ($fullview) {
$viewtype = 'display';
}
if (is_array($entities) && sizeof($entities) > 0) {
$html .= form_view_entities($entities, $form, $viewtype);
}
if ($count)
$html .= $nav;
echo $html;
?>
\ No newline at end of file
<?php
/**
* Form extended field display
*
* @package form
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Kevin Jardine <kevin@radagast.biz>
* @copyright Radagast Solutions 2008
* @link http://radagast.biz/
*/
$value = $vars['value'];
$title = $vars['title'];
$body = <<<END
<label>$title<br />
<p>$value</p>
</label>
END;
print $body;
?>
\ No newline at end of file
<?php
$form_id = $vars['form_id'];
$profile = $vars['profile'];
$edit_msg = elgg_echo('form:edit');
$remove_msg = elgg_echo('form:remove');
$remove_confirm_msg = elgg_echo('form:remove_confirm');
$moveup_msg = elgg_echo('form:move_up');
$movedown_msg = elgg_echo('form:move_down');
$movetop_msg = elgg_echo('form:move_top');
$movebottom_msg = elgg_echo('form:move_bottom');
$img_template = '<img border="0" width="16" height="16" alt="%s" title="%s" src="'.$vars['config']->wwwroot.'mod/form/images/%s" />';
$edit_img = sprintf($img_template,$edit_msg,$edit_msg,"16-em-pencil.png");
$remove_img = sprintf($img_template,$remove_msg,$remove_msg,"16-em-cross.png");
$moveup_img = sprintf($img_template,$moveup_msg,$moveup_msg,"16-em-open.png");
$movedown_img = sprintf($img_template,$movedown_msg,$movedown_msg,"16-em-down.png");
$movetop_img = sprintf($img_template,$movetop_msg,$movetop_msg,"16-em-left.png");
$movebottom_img = sprintf($img_template,$movebottom_msg,$movebottom_msg,"16-em-right.png");
$start_url = $vars['config']->wwwroot.'action/form/manage_field?form_action=move&id=%s&form_id=%s&direction=';
$link_template = '<a onclick="javascript:$(\'#field_list\').load(\'%s%s\'); return false;" href="%s%s">%s</a>';
$field_template = <<<END
<a href="{$vars['config']->wwwroot}action/form/manage_field?form_action=edit&id=%s&form_id=%s&profile=$profile">$edit_img</a> |
<a onclick="return confirm('$remove_confirm_msg')" href="{$CONFIG->wwwroot}action/form/manage_field?form_action=remove&id=%s&form_id=%s">$remove_img</a> |
%s |
%s |
%s |
%s
%s
<br />
END;
$fields = $vars['fields'];
if ($fields && count($fields) > 0 ) {
foreach ($fields AS $field) {
$ident = $field->getGUID();
$url = sprintf($start_url,$ident,$form_id);
$up = sprintf($link_template,$url,'up',$url,'up',$moveup_img);
$down = sprintf($link_template,$url,'down',$url,'down',$movedown_img);
$top = sprintf($link_template,$url,'top',$url,'top',$movetop_img);
$bottom = sprintf($link_template,$url,'bottom',$url,'bottom',$movebottom_img);
$field_list .= sprintf( $field_template,$ident,$form_id,$ident,$form_id,
$up,$down,$top,$bottom,
$field->title . ' ('.$field->internal_name.': '.$field->field_type.')');
}
$field_list .= '<br />';
} else {
$field_list .= '<p>'.elgg_echo('form:none').'.</p>';
}
echo $field_list;
?>
\ No newline at end of file
<?php
$manage_bit = '<div class="form-manage">';
$manage_bit .= '<a href="'.$vars['url'].'mod/form/form.php?id='.$vars['form_id'].'&d='.$vars['form_data_id'].'">';
$manage_bit .= elgg_echo('form:edit');
$manage_bit .= '</a> | ';
$manage_bit .= '<a onclick="return confirm(\''.elgg_echo('form:content_delete_confirm').'\')" ';
$manage_bit .= 'href="'.$vars['url'].'action/form/manage_form_data?form_action=delete&d='.$vars['form_data_id'].'">';
$manage_bit .= elgg_echo('form:delete');
$manage_bit .= '</a>';
$manage_bit .= '</div><br />';
echo $manage_bit;
?>
\ No newline at end of file
<?php
/**
* Elgg field display
* Displays the specified Elgg title, field and description
*
* @package Elgg
* @subpackage Form
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Kevin Jardine <kevin@radagast.biz>
* @copyright Radagast Solutions 2008
* @link http://radagast.biz/
*/
$tab_data = $vars['tab_data'];
$form = $vars['form'];
$preview = $vars['preview'];
$form_data_id = $vars['form_data_id'];
if (isset($vars['description'])) {
$description = $vars['description'];
} else {
$description = form_form_t($form,'description');
}
if ($preview) {
$body = '<div class="contentWrapper">'.elgg_echo('form:preview_description').'</div>';
} else {
$body = '';
}
// TODO - add some intelligent way to determine the form enctype?
$body .= <<<END
<script type="text/javascript" src="{$vars['url']}mod/form/tabber/tabber.js"></script>
<link rel="stylesheet" href="{$vars['url']}mod/form/tabber/example.css" type="text/css" media="screen" />
<div class="contentWrapper">
$description
</div>
<div class="contentWrapper">
<form action="{$vars['url']}action/form/submit" method="post" enctype="multipart/form-data">
END;
$body .= elgg_view('input/hidden',array('internalname'=>'form_id', 'value'=>$form->getGUID()));
$body .= elgg_view('input/hidden',array('internalname'=>'preview', 'value'=>$preview));
$body .= elgg_view('input/hidden',array('internalname'=>'form_data_id', 'value'=>$form_data_id));
$count = count($tab_data);
if ($count > 1) {
$body .= '<div class="tabber">';
$body .= '<div class="tabberloading" ></div>';
foreach($tab_data as $tab => $html) {
if ($html) {
$body .= "<div class=\"tabbertab\" title=\"$tab\">";
$body .= $html;
$body .= "</div>\n";
}
}
$body .= '</div>';
} else if ($count == 1) {
// don't show tabs if there is only one
foreach($tab_data as $tab => $html) {
$body .= $html;
}
}
$body .= elgg_view('input/submit', array('internalname'=>'submit','value'=>elgg_echo('form:submit')));
$body .= '</form></div>';
print $body;
?>
\ No newline at end of file
<?php
/**
* Elgg form display
*
* @package Elgg
* @subpackage Form
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Kevin Jardine <kevin@radagast.biz>
* @copyright Radagast Solutions 2008
* @link http://radagast.biz/
*/
$tab_data = $vars['tab_data'];
$form = $vars['form'];
$preview = $vars['preview'];
$form_data_id = $vars['form_data_id'];
if (isset($vars['description'])) {
$description = $vars['description'];
} else {
$description = form_t($form,'description');
}
if ($preview) {
$body = '<p class="form-description">'.elgg_echo('form:preview_description').'</p>';
} else {
$body = '';
}
$body .= elgg_view('input/hidden',array('internalname'=>'form_id', 'value'=>$form->getGUID()));
$body .= elgg_view('input/hidden',array('internalname'=>'preview', 'value'=>$preview));
$body .= elgg_view('input/hidden',array('internalname'=>'form_data_id', 'value'=>$form_data_id));
$body .= "<p class=\"form-description\">$description</p>";
if (count($tab_data) > 1) {
$body .= <<<END
<script type="text/javascript" src="{$CONFIG->wwwroot}mod/form/tabber/tabber.js"></script>
<link rel="stylesheet" href="{$CONFIG->wwwroot}mod/form/tabber/example.css" type="text/css" media="screen" />
END;
$body .= '<div class="tabber">';
$body .= '<div class="tabberloading" ></div>';
foreach($tab_data as $tab => $html) {
if ($html) {
$body .= "<div class=\"tabbertab\" title=\"$tab\">";
$body .= $html;
$body .= "</div>\n";
}
}
$body .= '</div>';
} else if (count($tab_data) == 1) {
foreach($tab_data as $tab => $html) {
$body .= $html;
}
}
echo $body;
?>
\ No newline at end of file
<?php
/* buttons and links:
*
* preview form (link)
* add existing field (input box for field name)
* copy existing field (copies field definition) (input boxes for field name)
* add new field (input box for field name)
*/
$form_id = $vars['form_id'];
$profile = $vars['profile'];
//TODO: clean this up
$add_existing_button = elgg_echo('form:add_existing_button');
$add_existing_field_description = elgg_echo('form:add_existing_field_description');
$copy_existing_button = elgg_echo('form:copy_existing_button');
$copy_existing_field_description = elgg_echo('form:copy_existing_field_description');
$add_new_button = elgg_echo('form:add_new_button');
$add_new_description = elgg_echo('form:add_new_description');
$existing_label = elgg_echo('form:existing_label');
$new_label = elgg_echo('form:new_label');
$add_fields_title = elgg_echo('form:add_fields_title');
$add_existing_title = elgg_echo('form:add_existing_title');
$copy_existing_title = elgg_echo('form:copy_existing_title');
$add_new_title = elgg_echo('form:add_new_title');
$field_adders_tab = elgg_echo('form:field_adders_tab_label');
$buttons = <<<END
<div class="tabbertab" title="$field_adders_tab">
<form action="{$vars['url']}action/form/manage_field" method="post">
<input type="hidden" name="form_id" value="$form_id">
<input type="hidden" name="form_action" value="add_new">
<input type="hidden" name="profile" value="$profile">
<label class="labelclass" for="new_field_name">$new_label</label>
END;
$buttons .= elgg_view('input/text',array('internalname'=>'new_field_name'));
$buttons .= <<<END
<br />
<span class="description">$add_new_description<br />
<input type="submit" name="submit" value="$add_new_button"></span>
</form>
<br />
<form action="{$vars['url']}action/form/manage_field" method="post">
<input type="hidden" name="form_id" value="$form_id">
<input type="hidden" name="form_action" value="add_existing">
<input type="hidden" name="profile" value="$profile">
<label class="labelclass" for="existing_field_name">$existing_label</label>
END;
$buttons .= elgg_view('input/text',array('internalname'=>'existing_field_name'));
$buttons .= <<<END
<br />
<span class="description">$add_existing_field_description<br />
<input type="submit" name="submit" value="$add_existing_button"></span>
</form>
<form action="{$vars['url']}action/form/manage_field" method="post">
<input type="hidden" name="form_id" value="$form_id">
<input type="hidden" name="form_action" value="copy_existing">
<input type="hidden" name="profile" value="$profile">
<label class="labelclass" for="existing_field_name">$existing_label</label>
END;
$buttons .= elgg_view('input/text',array('internalname'=>'existing_field_name'));
$buttons .= <<<END
<label class="labelclass" for="new_field_name">$new_label</label>
END;
$buttons .= elgg_view('input/text',array('internalname'=>'new_field_name'));
$buttons .= <<<END
<p class="description">$copy_existing_field_description<br />
<input type="submit" name="submit" value="$copy_existing_button"></p>
</form>
</div>
END;
echo $buttons;
?>
\ No newline at end of file
<?php
/**
* Elgg list fields view
*
* @package Form
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Kevin Jardine <kevin@radagast.biz>
* @copyright Radagast Solutions 2008
* @link http://radagast.biz/
*
* @uses $vars['form'] Optionally, the form to edit
*/
$type = $vars['page_return_type'];
$fields = $vars['fields'];
$username = $vars['user']->username;
$edit_msg = elgg_echo('form:edit');;
$delete_msg = elgg_echo('form:delete');
$delete_orphans_confirm_msg = elgg_echo('form:orphan_delete_all_confirm');
if ($type == 'orphan') {
$delete_confirm_msg = elgg_echo('form:orphan_delete_confirm');
} else {
$delete_confirm_msg = elgg_echo('form:field_delete_confirm');
}
$img_template = '<img border="0" width="16" height="16" alt="%s" title="%s" src="'.$CONFIG->wwwroot.'mod/form/images/%s" />';
$edit_img = sprintf($img_template,$edit_msg,$edit_msg,"16-em-pencil.png");
$delete_img = sprintf($img_template,$delete_msg,$delete_msg,"16-em-cross.png");
$field_template = <<<END
<a href="{$CONFIG->wwwroot}action/form/manage_field?form_action=edit_with_field_id&id=%s&type=%s&username=$username">$edit_img</a> |
<a onclick="return confirm('$delete_confirm_msg')" href="{$CONFIG->wwwroot}action/form/manage_field?form_action=delete&id=%s&type=%s&username=$username">$delete_img</a>
&nbsp;&nbsp;&nbsp;%s
<br />
END;
$body .= '<div class="contentWrapper">';
if ($type == 'orphan') {
$body .= '<p><b><a onclick="return confirm(\''.$delete_orphans_confirm_msg.'\')" href="'.$CONFIG->wwwroot.'action/form/manage_fields?form_action=delete_orphans&username='.$username.'">'.elgg_echo('form:delete_orphans').'</a></b></p> '."\n";
$body .= '<p>'.elgg_echo('form:orphan_list_description').'</p>'."\n";
} else {
$body .= '<p>'.elgg_echo('form:field_list_description').'</p>'."\n";
}
if ($fields) {
foreach ($fields as $field) {
$field_id = $field->getGUID();
$body .= sprintf(
$field_template,
$field_id,
$type,
$field_id,
$type,
$field->title . ' ('.$field->internal_name.': '.$field->field_type.')');
}
} else {
$body .= '<p>'.elgg_echo('form:no_fields').'</p>';
}
$body .= '</div>';
print $body;
?>
\ No newline at end of file
<?php
/*
* Elgg Forms
* Kevin Jardine
* Radagast Solutions
* http://radagast.biz
*
* Displays existing forms
*
*/
// load form model
require_once(dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/models/model.php");
//$title = elgg_echo('form:list_forms_title');
$view_all_text = elgg_echo('form:view_all');
$form_template = <<<END
<div class="contentWrapper">
<h2>%s</h2>
<p>
%s
</p>
%s
<a href="{$CONFIG->wwwroot}mod/form/my_forms.php?id=%s&form_view=all">$view_all_text</a>
%s
</div>
END;
//$pg_owner_entity = page_owner_entity();
//$username = $pg_owner_entity->username;
$body = '';
$profile_form = form_get_latest_public_profile_form();
if ($profile_form) {
$sd_list = get_entities_from_metadata('form_id',$profile_form->getGUID(),'object','form:search_definition');
if ($sd_list) {
$body .= '<div class="contentWrapper">';
$body .= '<h2>'.elgg_echo('form:profiles').'</h2><br />';
foreach($sd_list as $sd) {
$sd_id = $sd->getGUID();
$body .= "<a href=\"{$vars['url']}mod/form/search.php?sid=$sd_id\">".form_search_definition_t($form,$sd,'title')."</a><br />";
}
$body .= '</div>';
}
}
$forms = get_entities_from_metadata('profile','0','object','form:form');
if ($forms) {
foreach ($forms as $form) {
$form_id = $form->getGUID();
if (isloggedin()) {
$add_bit = '<a href="'.$vars['url'].'mod/form/form.php?id='.$form_id.'">'.elgg_echo('form:add_content').'</a> | ';
} else {
$add_bit = '';
}
$sd_bit = '';
$sd_list = get_entities_from_metadata('form_id',$form_id,'object','form:search_definition');
if ($sd_list) {
foreach($sd_list as $sd) {
$sd_id = $sd->getGUID();
$sd_bit .= "| <a href=\"{$vars['url']}mod/form/search.php?sid=$sd_id\">".form_search_definition_t($form,$sd,'title')."</a>";
}
}
$body .= sprintf($form_template,form_form_t($form,'title'),form_form_t($form,'listing_description'),$add_bit,$form_id,$sd_bit);
}
} else {
if (!$profile_form) {
$body .= '<p>'.elgg_echo('form:no_content').'</p>';
}
}
print $body;
?>
\ No newline at end of file
<?php
/*
* Elgg Forms
* Kevin Jardine
* Radagast Solutions
* http://radagast.biz
*
* Displays existing search definitions
*
*/
$edit_msg = elgg_echo('form:edit');
$delete_msg = elgg_echo('form:delete');
$delete_confirm_msg = elgg_echo('form:search_definition_delete_confirm');
$search_page = elgg_echo('form:search_page_link');
$img_template = '<img border="0" width="16" height="16" alt="%s" title="%s" src="'.$CONFIG->wwwroot.'mod/form/images/%s" />';
$edit_img = sprintf($img_template,$edit_msg,$edit_msg,"16-em-pencil.png");
$delete_img = sprintf($img_template,$delete_msg,$delete_msg,"16-em-cross.png");
$sd_template = <<<END
<a href="{$CONFIG->wwwroot}mod/form/manage_search_definition.php?sid=%s">$edit_img</a> |
<a onclick="return confirm('$delete_confirm_msg')" href="{$CONFIG->wwwroot}action/form/manage_search_definition?form_action=delete&sid=%s">$delete_img</a> |
<a href="{$CONFIG->wwwroot}mod/form/search.php?sid=%s">$search_page</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;%s (%s)
<br />
END;
$body = '<div class="contentWrapper">';
$form_id = get_input('form_id',0);
$sds = get_entities_from_metadata('form_id',$form_id,'object','form:search_definition');
if ($sds) {
foreach ($sds as $sd) {
$ident = $sd->getGUID();
$body .= sprintf($sd_template,$ident,$ident,$ident,$sd->title,$sd->internalname);
}
} else {
$body .= '<p>'.elgg_echo('form:no_search_definitions').'</p>';
}
$body .= '</div>';
print $body;
?>
\ No newline at end of file
<?php
/*
* Elgg Forms
* Kevin Jardine
* Radagast Solutions
* http://radagast.biz
*
* Displays existing forms
*
*/
$title = elgg_echo('form:list_forms_title');
$edit_msg = elgg_echo('form:edit');
$delete_msg = elgg_echo('form:delete');
$delete_confirm_msg = elgg_echo('form:form_delete_confirm');
$img_template = '<img border="0" width="16" height="16" alt="%s" title="%s" src="'.$CONFIG->wwwroot.'mod/form/images/%s" />';
$edit_img = sprintf($img_template,$edit_msg,$edit_msg,"16-em-pencil.png");
$delete_img = sprintf($img_template,$delete_msg,$delete_msg,"16-em-cross.png");
$export_text = elgg_echo('form:export');
$preview_text = elgg_echo('form:preview');
$link_text = elgg_echo('form:link');
$form_template = <<<END
<a href="{$CONFIG->wwwroot}mod/form/manage_form.php?id=%s">$edit_img</a> |
<a onclick="return confirm('$delete_confirm_msg')" href="{$CONFIG->wwwroot}action/form/manage_form?form_action=delete&id=%s">$delete_img</a> |
<a href="{$CONFIG->wwwroot}mod/form/form.php?id=%s&preview=true">$preview_text</a> |
<a href="{$CONFIG->wwwroot}mod/form/form.php?id=%s">$link_text</a>
&nbsp;&nbsp;&nbsp;%s
<br />
END;
$body = '<div class="contentWrapper">';
/*$user_content_status = form_get_user_content_status();
$body .= '<h2>'.elgg_echo('form:user_content_status_title').'</h2><br />';
$options = array( 1=>elgg_echo('form:yes'),
0=>elgg_echo('form:no') );
$body .= '<form action="'.$CONFIG->wwwroot.'action/form/manage_form" method ="post" >';
$body .= elgg_view('input/hidden',array('internalname'=>'form_action', 'value'=>'user_content_status'));
$body .= elgg_view('form/input/radio',array('internalname'=>'user_content_status','options'=>$options,'value'=>$user_content_status));
$body .= elgg_view('input/submit', array('internalname'=>'submit','value'=>elgg_echo('form:submit')));
$body .= '</form>';*/
$body .= '<h2>'.elgg_echo('form:form_list').'</h2><br />';
$forms = get_entities('object','form:form');
if ($forms) {
foreach ($forms as $form) {
$ident = $form->getGUID();
$body .= sprintf($form_template,$ident,$ident,$ident,$ident,$form->title.' ('.$form->name.')');
}
} else {
$body .= '<p>'.elgg_echo('form:no_forms').'</p>';
}
$body .= '</div>';
echo $body;
?>
\ No newline at end of file
This diff is collapsed.
<?php
/**
* Elgg manage form view
*
* @package Form
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Kevin Jardine <kevin@radagast.biz>
* @copyright Radagast Solutions 2008
* @link http://radagast.biz/
*
* @uses $vars['form'] Optionally, the form to edit
*/
$form = $vars['form'];
$username = $vars['form_username'];
$profile = $vars['profile'];
if ($form) {
if ($form->profile) {
$profile = $form->profile;
} else {
$profile = 0;
}
}
$type_options = form_type_options();
if ($form) {
$form_action = 'change';
$explanation = elgg_echo('form:form_manage_description');
$form_manage_button = elgg_echo('form:form_manage_button');
$form_id = $form->getGUID();
$form_name = $form->name;
$form_title = $form->title;
$description = $form->description;
$access_id = $form->access_id;
$field_list = elgg_view('form/field_list',array('fields' => $vars['fields'],'form_id' => $form_id, 'profile' => $profile));
if (($profile == 0) || ($profile == 3)) {
// this bit is just for data or file forms
$display_bit = elgg_view('form/display_templates',array('form'=>$form));
} else {
$display_bit = '';
}
$buttons = elgg_view('form/forms/field_adders',array('form_id'=>$form_id,'profile'=>$profile));
$basic_tab = elgg_echo('form:basic_tab_label');
$tab_bit= <<<END
<script type="text/javascript" src="{$vars['url']}mod/form/tabber/tabber.js"></script>
<link rel="stylesheet" href="{$vars['url']}mod/form/tabber/example.css" type="text/css" media="screen" />
<div class="tabber">
<div class="tabberloading" ></div>
<div class="tabbertab" title="$basic_tab">
END;
} else {
$form_action = 'add';
$manage_form_title = '';
$explanation = elgg_echo('form:create_form_description');
$form_manage_button = elgg_echo('form:create_form_button');
$form_id = 0;
$form_name = '';
$form_title = '';
$description = '';
$access_id = ACCESS_PRIVATE;
$display_bit = '';
$field_list = '';
$buttons = '';
$tab_bit = '';
}
// top of form
$body = <<<END
<div class="contentWrapper">
<p>$explanation</p>
$tab_bit
<form action="{$vars['config']->wwwroot}action/form/manage_form" method="post">
<h1>$manage_form_title</h1>
<input type="hidden" name="form_id" value="$form_id">
<input type="hidden" name="form_action" value="$form_action">
<input type="hidden" name="username" value="$username">
END;
// form name
$body .= '<label class="labelclass" for="form_name">'.elgg_echo('form:name_label').'</label>';
$body .= elgg_view('input/text',array('internalname'=>'form_name','value'=>$form_name));
$body .= '<p class="description">'.elgg_echo('form:name_description').'</p>';
// form title
$body .= '<label class="labelclass" for="form_title">'.elgg_echo('form:title_label').'</label>';
$body .= elgg_view('input/text',array('internalname'=>'form_title','value'=>$form_title));
$body .= '<p class="description">'.elgg_echo('form:form_title_description').'</p>';
// form content creation description
$body .= '<label class="labelclass" for="description">'.elgg_echo('form:description_label').'</label>';
$body .= elgg_view('input/longtext',array('internalname'=>'description','value'=>$description));
$body .= '<p class="description">'.elgg_echo('form:form_description_description').'</p>';
// form type
$body .= '<label class="labelclass" for="form_type">'.elgg_echo('form:type_label').'</label>';
$body .= elgg_view('input/pulldown',array('internalname'=>'profile','options_values'=>$type_options,'value'=>$profile));
$body .= '<p class="description">'.elgg_echo('form:type_description').'</p>';
// access levels
$body .= '<label class="labelclass" for="access">'.elgg_echo('form:form_access_label').'</label>';
$body .= elgg_view('input/access', array('internalname' => 'access_id','value' => $access_id));
$body .= '<p class="description">'.elgg_echo('form:form_access_description').'</p>';
if ($form) {
$body .= '<input type="submit" name="submit" value="'.$form_manage_button.'">';
$body .= '</div>';
}
if ($profile != 3) {
// file forms don't use this
$body .= elgg_view('form/manage_form_last_bit',array('form'=>$form));
}
$body .= $display_bit;
if ($form) {
$body .= '</form>';
$body .= $buttons;
$body .= '<div class="tabbertab" title="'.elgg_echo('form:field_list_tab_label').'">';
$body .= '<h2>'.elgg_echo('form:current_fields').'</h2><br />';
$body .= '<div id="field_list">';
$body .= $field_list;
$body .= '</div>';
$body .= '</div>';
} else {
$body .= '<input type="submit" name="submit" value="'.$form_manage_button.'">';
$body .= '</form>';
}
// bottom of form
$body .= <<<END
</div>
END;
if ($form) {
$body .= '</div>';
}
print $body;
?>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment