[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [14508] php templates to xsl
From: |
Saul |
Subject: |
[Fmsystem-commits] [14508] php templates to xsl |
Date: |
Wed, 02 Dec 2015 00:13:39 +0000 |
Revision: 14508
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14508
Author: psaul
Date: 2015-12-02 00:13:38 +0000 (Wed, 02 Dec 2015)
Log Message:
-----------
php templates to xsl
Modified Paths:
--------------
branches/dev-syncromind/activitycalendarfrontend/inc/class.uiactivity.inc.php
branches/dev-syncromind/activitycalendarfrontend/templates/base/activity.xsl
branches/dev-syncromind/activitycalendarfrontend/templates/base/activity_new.xsl
Modified:
branches/dev-syncromind/activitycalendarfrontend/inc/class.uiactivity.inc.php
===================================================================
---
branches/dev-syncromind/activitycalendarfrontend/inc/class.uiactivity.inc.php
2015-12-01 00:45:26 UTC (rev 14507)
+++
branches/dev-syncromind/activitycalendarfrontend/inc/class.uiactivity.inc.php
2015-12-02 00:13:38 UTC (rev 14508)
@@ -15,6 +15,7 @@
class activitycalendarfrontend_uiactivity extends
activitycalendar_uiactivities {
private $so_organization;
+// private $so_activity;
public $public_functions = array
(
'add' => true,
@@ -30,6 +31,7 @@
public function __construct() {
parent::__construct();
$this->so_organization =
activitycalendar_soorganization::get_instance();
+// $this->so_activity = activitycalendar_soactivity::get_instance();
}
/**
@@ -54,41 +56,31 @@
$organizations = $this->so_organization->get(null, null,
'org.name', true, null, null, null);
$activity = new activitycalendar_activity();
+
+ $o_id = phpgw::get_var('organization_id');
+ $o_id_new = phpgw::get_var('organization_id_hidden');
$organization_options = Array();
- foreach ($organizations as $organization) {
+ foreach ($organizations as $o) {
$organization_options[] = array(
- 'id' => $organization->get_id(),
- 'name' => $organization->get_name()
+ 'id' => $o->get_id(),
+ 'name' => $o->get_name()
);
}
$category_options = Array();
- $category_options['current_category_id'] = ($activity->get_category())
? $activity->get_category() : "";
- foreach ($categories as $category) {
+ foreach ($categories as $c) {
$category_options['list'][] = array(
- 'id' => $category->get_id(),
- 'name' => $category->get_name()
+ 'id' => $c->get_id(),
+ 'name' => $c->get_name()
);
}
- $current_target_ids = $activity->get_target();
- $current_target_id_array = explode(",", $current_target_ids);
- $target_options = Array();
- foreach ($targets as $target) {
- $checked = (in_array($target->get_id(), $current_target_id_array))
? "checked" : "";
- $target_options[] = array(
- 'id' => $target->get_id(),
- 'name' => $target->get_name(),
- 'checked' => $checked
- );
- }
-
$arena_options = Array();
- foreach ($arenas as $arena) {
+ foreach ($arenas as $a) {
$arena_options[] = array(
- 'id' => $arena->get_id(),
- 'name' => $arena->get_arena_name()
+ 'id' => $a->get_id(),
+ 'name' => $a->get_arena_name()
);
}
@@ -101,25 +93,13 @@
}
$office_options = Array();
- $office_options['selected_office'] = ($activity->get_office()) ?
$activity->get_office() : "";
- foreach ($offices as $office) {
+ foreach ($offices as $o) {
$office_options['list'][] = array(
- 'id' => $office['id'],
- 'name' => $office['name']
+ 'id' => $o['id'],
+ 'name' => $o['name']
);
}
-
- $activity_options = Array();
- $activity_options['id'] = ($activity->get_id()) ? $activity->get_id()
: 0;
- $activity_options['time'] = $activity->get_time();
- $activity_options['title'] = $activity->get_title();
- $o_id = phpgw::get_var('organization_id');
- $o_id_new = phpgw::get_var('organization_id_hidden');
-
- $o_id = 1098;
- $_POST['step_1'] = 'Neste';
-
if (isset($_POST['step_1']))
{ //activity shall be registred on a new organization
@@ -179,9 +159,28 @@
$activity->set_description($organization->get_description());
$activity->set_contact_persons($pers);
}
+
+ $activity_options = Array();
+ $activity_options['id'] = ($activity->get_id()) ?
$activity->get_id() : 0;
+ $activity_options['time'] = $activity->get_time();
+ $activity_options['title'] = $activity->get_title();
+ $category_options['current_category_id'] =
($activity->get_category()) ? $activity->get_category() : "";
+ $office_options['selected_office'] = ($activity->get_office()) ?
$activity->get_office() : "";
$organization_id = $organization->get_id();
-
+
+ $current_target_ids = $activity->get_target();
+ $current_target_id_array = explode(",", $current_target_ids);
+ $target_options = Array();
+ foreach ($targets as $t) {
+ $checked = (in_array($t->get_id(), $current_target_id_array))
? "checked" : "";
+ $target_options[] = array(
+ 'id' => $t->get_id(),
+ 'name' => $t->get_name(),
+ 'checked' => $checked
+ );
+ }
+
$this->render_template_xsl('activity_new', array
(
'activity' => $activity_options,
@@ -341,8 +340,6 @@
$district_ok = true;
}
- $organization_id = $organization->get_id();
-
if ($target_ok && $district_ok) {
if ($this->so_activity->store($activity)) { //
... and then try to store the object
$message = lang('messages_saved_form');
@@ -351,15 +348,54 @@
}
//$org_info_edit_url = self::link('/index.php'
,array('menuaction' =>
'activitycalendarfrontend.uiactivity.edit_organization_values'));
+ $GLOBALS['phpgw_info']['flags']['noframework']
= true;
+ $activity_options = Array();
+ $activity_options['id'] = ($activity->get_id()) ?
$activity->get_id() : "0";
+ $activity_options['title'] = $activity->get_title();
+ $activity_options['description'] =
$activity->get_description();
+ $activity_options['category'] = ($activity->get_category()) ?
$this->so_activity->get_category_name($activity->get_category()) : "";
+ $activity_options['targets'] = "";
+ $activity_options['special_adaptation'] =
($activity->get_special_adaptation()) ? true : false;
+ $activity_options['internal_arena'] =
($activity->get_internal_arena()) ? true : false;
+ $activity_options['building_name'] =
$this->so_arena->get_building_name($activity->get_internal_arena());
+ $activity_options['arena'] = ($activity->get_arena()) ? true :
false;
+ $activity_options['arena_name'] =
$this->so_arena->get_arena_name($activity->get_arena());
+ $activity_options['districts'] = "";
+ $activity_options['time'] = $activity->get_time();
+ $activity_options['contact_person_1'] =
($activity->get_contact_person_1()) ? true : false;
+ $activity_options['contact1_name'] = (isset($persons[0])) ?
$persons[0]->get_name() : "";
+ $activity_options['contact1_phone'] = (isset($persons[0])) ?
$persons[0]->get_phone() : "";
+ $activity_options['contact1_mail'] = (isset($persons[0])) ?
$persons[0]->get_email() : "";
+ $activity_options['office'] = ($activity->get_office()) ?
$this->so_activity->get_office_name($activity->get_office()) : "";
+
+ if ($activity->get_target()) {
+ $current_target_ids = $activity->get_target();
+ $current_target_id_array = explode(",",
$current_target_ids);
+ foreach ($current_target_id_array as $ct) {
+ $activity_options['targets'] .=
$this->so_activity->get_target_name($ct) . "<br />";
+ }
+ }
+
+ if ($activity->get_district()) {
+ $current_district_ids = $activity->get_district();
+ $current_district_id_array = explode(",",
$current_district_ids);
+ foreach ($current_district_id_array as $cd) {
+ $activity_options['districts'] .=
$this->so_activity->get_district_name($cd) . "<br />";
+ }
+ }
+
+ $organization_options = Array();
+ $organization_options['id'] = $organization->get_id();
+ $organization_options['name'] = $organization->get_name();
+ $organization_options['new_org'] = $activity->get_new_org();
+ $organization_options['edit_link'] =
self::link(array('menuaction' =>
'activitycalendarfrontend.uiactivity.edit_organization_values','organization_id'
=> $organization_options['id']));
- $GLOBALS['phpgw_info']['flags']['noframework']
= true;
- $this->render('activity.php', array
- (
- 'activity' => $activity,
- 'organization' => $organization,
- 'organization_id' => $organization_id,
+ $this->render_template_xsl('activity', array
+ (
+ 'activity' => $activity_options,
+ 'organization' =>
$organization_options,
'group' => $group,
'contact1' => $persons[0],
'arenas' => $arenas,
@@ -371,8 +407,27 @@
'message' => isset($message) ?
$message : phpgw::get_var('message'),
'error' => isset($error) ?
$error : phpgw::get_var('error'),
'ajaxURL' => $ajaxUrl
- )
+ )
);
+
+// $this->render('activity.php', array
+// (
+// 'activity' => $activity,
+// 'organization' => $organization,
+// 'organization_id' => $organization_id,
+// 'group' => $group,
+// 'contact1' => $persons[0],
+// 'arenas' => $arenas,
+// 'buildings' => $buildings,
+// 'categories' => $categories,
+// 'targets' => $targets,
+// 'districts' => $districts,
+// 'offices' => $offices,
+// 'message' => isset($message) ?
$message : phpgw::get_var('message'),
+// 'error' => isset($error) ?
$error : phpgw::get_var('error'),
+// 'ajaxURL' => $ajaxUrl
+// )
+// );
} else {
if (!$target_ok) {
$error .= "<br/>" .
lang('target_not_selected');
@@ -380,26 +435,45 @@
if (!$district_ok) {
$error .= "<br/>" .
lang('district_not_selected');
}
- return $this->render('activity_new.php', array (
- 'activity' => $activity,
- 'organizations' => $organizations,
- 'organization' => $organization,
+
+ $activity_options = Array();
+ $activity_options['id'] = ($activity->get_id()) ?
$activity->get_id() : 0;
+ $activity_options['time'] = $activity->get_time();
+ $activity_options['title'] = $activity->get_title();
+ $category_options['current_category_id'] =
($activity->get_category()) ? $activity->get_category() : "";
+ $office_options['selected_office'] = ($activity->get_office())
? $activity->get_office() : "";
+
+ $organization_id = $organization->get_id();
+
+ $current_target_ids = $activity->get_target();
+ $current_target_id_array = explode(",", $current_target_ids);
+ $target_options = Array();
+ foreach ($targets as $t) {
+ $checked = (in_array($t->get_id(),
$current_target_id_array)) ? "checked" : "";
+ $target_options[] = array(
+ 'id' => $t->get_id(),
+ 'name' => $t->get_name(),
+ 'checked' => $checked
+ );
+ }
+
+ return
$this->render_template_xsl('activity_new', array (
+ 'activity' => $activity_options,
'organization_id' => $organization_id,
'contact1' => $persons[0],
'contact2' => $persons[1],
- 'org_name' => $org_name,
'new_org' => $new_org,
- 'groups' => $groups,
- 'arenas' => $arenas,
- 'buildings' => $buildings,
- 'categories' => $categories,
- 'targets' => $targets,
+ 'arenas' => $arena_options,
+ 'buildings' => $building_options,
+ 'categories' => $category_options,
+ 'targets' => $target_options,
'districts' => $districts,
- 'offices' => $offices,
+ 'offices' => $office_options,
'editable' => true,
'cancel_link' => $cancel_link,
'message' => isset($message) ? $message :
phpgw::get_var('message'),
'error' => isset($error) ? $error :
phpgw::get_var('error'),
+ 'helpImg' => $helpImg,
'ajaxURL' => $ajaxUrl
)
);
@@ -422,20 +496,56 @@
$errorMsgs = array();
$infoMsgs = array();
$activity = $this->so_activity->get_single((int)
phpgw::get_var('id'));
-
+
if ($activity == null) { // Not found
$errorMsgs[] = lang('Could not find specified
activity.');
}
+ $activity_options = Array();
+ $activity_options['id'] = ($activity->get_id()) ? $activity->get_id()
: "0";
+ $activity_options['title'] = $activity->get_title();
+ $activity_options['description'] = $activity->get_description();
+ $activity_options['category'] = ($activity->get_category()) ?
$this->so_activity->get_category_name($activity->get_category()) : "";
+ $activity_options['targets'] = "";
+ $activity_options['special_adaptation'] =
($activity->get_special_adaptation()) ? true : false;
+ $activity_options['internal_arena'] =
($activity->get_internal_arena()) ? true : false;
+ $activity_options['building_name'] =
$this->so_arena->get_building_name($activity->get_internal_arena());
+ $activity_options['arena'] = ($activity->get_arena()) ? true : false;
+ $activity_options['arena_name'] =
$this->so_arena->get_arena_name($activity->get_arena());
+ $activity_options['districts'] = "";
+ $activity_options['time'] = $activity->get_time();
+ $activity_options['contact_person_1'] =
($activity->get_contact_person_1()) ? true : false;
+ $activity_options['contact1_name'] = (isset($persons[0])) ?
$persons[0]->get_name() : "";
+ $activity_options['contact1_phone'] = (isset($persons[0])) ?
$persons[0]->get_phone() : "";
+ $activity_options['contact1_mail'] = (isset($persons[0])) ?
$persons[0]->get_email() : "";
+ $activity_options['office'] = ($activity->get_office()) ?
$this->so_activity->get_office_name($activity->get_office()) : "";
+
+ if ($activity->get_target()) {
+ $current_target_ids = $activity->get_target();
+ $current_target_id_array = explode(",", $current_target_ids);
+ foreach ($current_target_id_array as $ct) {
+ $activity_options['targets'] .=
$this->so_activity->get_target_name($ct) . "<br />";
+ }
+ }
+
+ if ($activity->get_district()) {
+ $current_district_ids = $activity->get_district();
+ $current_district_id_array = explode(",", $current_district_ids);
+ foreach ($current_district_id_array as $cd) {
+ $activity_options['districts'] .=
$this->so_activity->get_district_name($cd) . "<br />";
+ }
+ }
+
$data = array
(
- 'activity' => $activity,
+ 'activity' => $activity_options,
'errorMsgs' => $errorMsgs,
'infoMsgs' => $infoMsgs
);
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
- $this->render('activity.php', $data);
+// $this->render('activity.php', $data);
+ self::render_template_xsl('activity', $data);
//self::render_template('activity_tmp', array('activity' =>
$activity, 'frontend'=>'true'));
}
Modified:
branches/dev-syncromind/activitycalendarfrontend/templates/base/activity.xsl
===================================================================
---
branches/dev-syncromind/activitycalendarfrontend/templates/base/activity.xsl
2015-12-01 00:45:26 UTC (rev 14507)
+++
branches/dev-syncromind/activitycalendarfrontend/templates/base/activity.xsl
2015-12-02 00:13:38 UTC (rev 14508)
@@ -3,12 +3,12 @@
<div id="details">
<xsl:if test="message != ''">
<div class="success">
- <xsl:value-of select="message" />
+ <xsl:value-of select="message"
disable-output-escaping="yes" />
</div>
</xsl:if>
<xsl:if test="error != ''">
<div class="error">
- <xsl:value-of select="error" />
+ <xsl:value-of select="error" disable-output-escaping="yes"
/>
</div>
</xsl:if>
</div>
@@ -18,12 +18,12 @@
<form action="" method="post" name="form" id="form">
<input type="hidden" name="id">
<xsl:attributed name="value">
-
+ <xsl:value-of select="activity/id" />
</xsl:attributed>
</input>
<dl class="proplist-col">
<div class="form-buttons">
- <xsl:if test="change_request">
+ <xsl:if test="change_request = 1">
<input type="submit" name="activity_ok">
<xsl:attribute name="value">
<xsl:value-of select="php:function('lang',
'activity_ok')" />
@@ -42,19 +42,19 @@
<label for="title"><xsl:value-of
select="php:function('lang', 'activity_title')" /></label>
</dt>
<dd>
-
+ <xsl:value-of select="activity/title" />
</dd>
<dt>
<label for="description"><xsl:value-of
select="php:function('lang', 'description')" /></label>
</dt>
<dd>
-
+ <xsl:value-of select="activity/description"
disable-output-escaping="yes" />
</dd>
<dt>
<label for="category"><xsl:value-of
select="php:function('lang', 'category')" /></label>
</dt>
<dd>
-
+ <xsl:value-of select="activity/category"
disable-output-escaping="yes" />
</dd>
</fieldset>
<fieldset id="hvem">
@@ -63,63 +63,78 @@
<label for="target"><xsl:value-of
select="php:function('lang', 'target')" /></label>
</dt>
<dd>
-
+ <xsl:value-of select="activity/targets"
disable-output-escaping="yes" />
</dd>
<dt>
- <input type="checkbox" name="special_adaptation"
id="special_adaptation" disabled="disabled" />
+ <input type="checkbox" name="special_adaptation"
id="special_adaptation" disabled="disabled">
+ <xsl:if test="activity/special_adaptation = 1">
+ <xsl:attribute name="checked">
+ checked
+ </xsl:attribute>
+ </xsl:if>
+ </input>
<label for="special_adaptation"><xsl:value-of
select="php:function('lang', 'special_adaptation')" /></label>
</dt>
</fieldset>
<fieldset title="hvor">
<legend>Hvor og når</legend>
- <xsl:if test="">
+ <xsl:if test="activity/internal_arena = 1">
<dt>
<label for="arena"><xsl:value-of
select="php:function('lang', 'building')" /></label>
</dt>
<dd>
-
+ <xsl:value-of select="activity/building_name" />
</dd>
</xsl:if>
- <xsl:if test="">
+ <xsl:if test="activity/arena = 1">
<dt>
<label for="arena"><xsl:value-of
select="php:function('lang', 'arena')" /></label>
</dt>
<dd>
-
+ <xsl:value-of select="activity/arena_name"
disable-output-escaping="yes" />
</dd>
</xsl:if>
<dt>
<label for="district"><xsl:value-of
select="php:function('lang', 'district')" /></label>
</dt>
<dd>
-
+ <xsl:value-of select="activity/districts"
disable-output-escaping="yes" />
</dd>
<dt>
<label for="time"><xsl:value-of
select="php:function('lang', 'time')" /></label>
</dt>
<dd>
-
+ <xsl:value-of select="activity/time"
disable-output-escaping="yes" />
</dd>
</fieldset>
<fieldset id="arr">
<legend>Arrangør</legend>
<dd>
- <xsl:if test="">
- <a></a>
+ <xsl:value-of select="organization/name" />
+ <xsl:if test="change_request != 1">
+ <xsl:if test="organization/new_org != 1">
+ <a target="_blank">
+ <xsl:attribute name="href">
+ <xsl:value-of
select="organization/edit_link" />
+ </xsl:attribute>
+ <xsl:value-of select="php:function('lang',
'edit_organization')" />
+ </a>
+ </xsl:if>
</xsl:if>
</dd><br />
<legend>Kontaktperson</legend>
<dt>
- <xsl:if test="">
+ <xsl:if test="activity/contact_person_1 = 1">
<label for="contact_person_1"><xsl:value-of
select="php:function('lang', 'contact_person')" /></label>
</xsl:if>
</dt>
<dd>
- <label for="contact1_name">Navn</label>
-
- <label for="contact1_phone">Telefon</label>
-
- <label for="contact1_mail">E-post</label>
+ <label for="contact1_name">Navn </label>
+ <xsl:value-of select="concat(' ',
activity/contact1_name)" /><br />
+ <label for="contact1_phone">Telefon </label>
+ <xsl:value-of select="concat(' ',
activity/contact1_phone)" /><br />
+ <label for="contact1_mail">E-post </label>
+ <xsl:value-of select="concat(' ',
activity/contact1_mail)" /><br />
</dd>
</fieldset>
<fieldset>
@@ -128,12 +143,12 @@
<label for="office">Kulturkontor</label>
</dt>
<dd>
-
+ <xsl:value-of select="activity/office"
disable-output-escaping="yes" />
</dd>
</fieldset>
<br /><br />
<div class="form-buttons">
- <xsl:if test="change_request">
+ <xsl:if test="change_request = 1">
<input type="submit" name="activity_ok">
<xsl:attribute name="value">
<xsl:value-of select="php:function('lang',
'activity_ok')" />
Modified:
branches/dev-syncromind/activitycalendarfrontend/templates/base/activity_new.xsl
===================================================================
---
branches/dev-syncromind/activitycalendarfrontend/templates/base/activity_new.xsl
2015-12-01 00:45:26 UTC (rev 14507)
+++
branches/dev-syncromind/activitycalendarfrontend/templates/base/activity_new.xsl
2015-12-02 00:13:38 UTC (rev 14508)
@@ -3,12 +3,12 @@
<div id="details">
<xsl:if test="message != ''">
<div class="success">
- <xsl:value-of select="message" />
+ <xsl:value-of select="message"
disable-output-escaping="yes" />
</div>
</xsl:if>
<xsl:if test="error != ''">
<div class="error">
- <xsl:value-of select="error" />
+ <xsl:value-of select="error" disable-output-escaping="yes"
/>
</div>
</xsl:if>
</div>
@@ -16,7 +16,7 @@
<h1><xsl:value-of select="php:function('lang', 'new_activity')"
/></h1>
<div><xsl:value-of select="php:function('lang',
'required_fields')" /></div>
</div>
- <form method="POST" name="form" id="form">
+ <form action="" method="POST" name="form" id="form">
<input type="hidden" name="id">
<xsl:attribute name="value">
<xsl:value-of select="activity/id" />
@@ -27,7 +27,7 @@
<xsl:value-of select="organization_id" />
</xsl:attribute>
</input>
- <xsl:if test="new_organization">
+ <xsl:if test="new_organization = 1">
<input type="hidden" name="new_organization" value="yes" />
</xsl:if>
<input type="hidden" name="new_arena_hidden" id="new_arena_hidden"
value="" />
@@ -121,7 +121,7 @@
<xsl:value-of select="checked" />
</xsl:attribute>
</xsl:if>
- <xsl:attribute name="id">
+ <xsl:attribute name="value">
<xsl:value-of select="id" />
</xsl:attribute>
</input>
@@ -164,7 +164,7 @@
<xsl:for-each select="buildings">
<option>
<xsl:attribute name="value">
- <xsl:value-of select="id" />
+ <xsl:value-of select="concat('i_',
id)" />
</xsl:attribute>
<xsl:value-of select="name" />
</option>
@@ -311,13 +311,14 @@
<dt>
<label for="office">
Hvilket kulturkontor skal motta registreringen (*)
+ </label>
<a href="javascript:void(0);">
<xsl:attribute name="onclick">
alert('<xsl:value-of
select="php:function('lang', 'help_new_activity_office')" />');return false;
</xsl:attribute>
+ <img alt="Hjelp" src="{helpImg}" />
</a>
- <img alt="Hjelp" src="{helpImg}" />
- </label>
+
</dt>
<dd>
<select name="office" id="office">
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [14508] php templates to xsl,
Saul <=