Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

consultationview.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: consultationview.php 9529 2002-05-14 11:17:05Z jhe $
5 //
6 // Created on: <23-Oct-2000 17:53:46 bf>
7 //
8 // This source file is part of Exponential Basic, publishing software.
9 //
10 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
11 //
12 // This program is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU General Public License
14 // as published by the Free Software Foundation; either version 2
15 // of the License, or (at your option) any later version.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
25 //
26
27 /*
28 View a consultation
29 */
30
31 // include_once( "classes/INIFile.php" );
32 // include_once( "classes/ezhttptool.php" );
33 // include_once( "classes/eztexttool.php" );
34
35 $ini =& eZINI::instance( 'site.ini' );
36 $Language = $ini->variable( "eZContactMain", "Language" );
37
38 // include_once( "ezuser/classes/ezusergroup.php" );
39 // include_once( "ezuser/classes/ezpermission.php" );
40
41 $user =& eZUser::currentUser();
42 if ( !is_a( $user, "eZUser" ) )
43 {
44 // include_once( "classes/ezhttptool.php" );
45 eZHTTPTool::header( "Location: /contact/nopermission/login" );
46 exit();
47 }
48
49 if ( !eZPermission::checkPermission( $user, "eZContact", "Consultation" ) &&
50 $ini->variable( "eZContactMain", "ShowAllConsultations" ) != "enabled" )
51 {
52 // include_once( "classes/ezhttptool.php" );
53 eZHTTPTool::header( "Location: /contact/nopermission/consultation" );
54 exit();
55 }
56 // include_once( "ezmail/classes/ezmail.php" );
57 // include_once( "classes/eztemplate.php" );
58 // include_once( "classes/ezdatetime.php" );
59 // include_once( "ezcontact/classes/ezconsultation.php" );
60 // include_once( "ezcontact/classes/ezconsultationtype.php" );
61 // include_once( "ezuser/classes/ezuser.php" );
62 // include_once( "ezuser/classes/ezusergroup.php" );
63
64 $t = new eZTemplate( "kernel/ezcontact/admin/" . $ini->variable( "eZContactMain", "AdminTemplateDir" ),
65 "kernel/ezcontact/admin/intl", $Language, "consultationedit.php" );
66 $t->setAllStrings();
67
68 $t->set_file( "consultation_view", "consultationview.tpl" );
69 $t->set_block( "consultation_view", "consultation_item_tpl", "consultation_item" );
70
71 $t->set_block( "consultation_item_tpl", "consultation_date_item_tpl", "consultation_date_item" );
72 $t->set_block( "consultation_item_tpl", "group_notice_select_tpl", "group_notice_select" );
73 $t->set_block( "consultation_item_tpl", "no_group_notice_tpl", "no_group_notice" );
74
75 $t->set_block( "consultation_view", "company_contact_item_tpl", "company_contact_item" );
76 $t->set_block( "consultation_view", "person_contact_item_tpl", "person_contact_item" );
77
78 $t->set_var( "consultation_date", "" );
79 $t->set_var( "consultation_date_item", "" );
80
81 $t->set_var( "short_description", "" );
82 $t->set_var( "description", "" );
83 $t->set_var( "email_notification", "" );
84
85 $t->set_var( "group_notice_name", "" );
86
87 $t->set_var( "state_id", "" );
88
89 $user =& eZUser::currentUser();
90
91 if ( !$user )
92 {
93 eZHTTPTool::header( "Location: /user/login" );
94 exit();
95 }
96
97 $status_id = 0;
98
99 /*
100 The user wants to edit an existing person.
101
102 We present a form with the info.
103 */
104
105 if ( !eZConsultation::belongsTo( $ConsultationID, $user->id() ) &&
106 $ini->variable( "eZContactMain", "ShowAllConsultations" ) != "enabled" )
107 {
108 print( "<h1>Sorry, This page isn't for you. </h1>" );
109 }
110 else
111 {
112 $consultation = new eZConsultation( $ConsultationID );
113
114 $t->set_var( "short_description", eZTextTool::htmlspecialchars( $consultation->shortDescription() ) );
115 $t->set_var( "description", eZTextTool::htmlspecialchars( $consultation->description() ) );
116 $t->set_var( "email_notification", eZTextTool::htmlspecialchars( $consultation->emails() ) );
117 $status_id = $consultation->state();
118
119 $companyid = $consultation->company();
120 $personid = $consultation->person();
121 if ( $companyid )
122 {
123 $t->parse( "company_contact_item", "company_contact_item_tpl" );
124 $t->set_var( "person_contact_item", "" );
125 $company = new eZCompany( $companyid );
126 $t->set_var( "company_name", eZTextTool::htmlspecialchars( $company->name() ) );
127 $owner = new eZUser( $consultation->owner( -1, false ) );
128 }
129 else if ( $personid )
130 {
131 $t->set_var( "company_contact_item", "" );
132 $t->parse( "person_contact_item", "person_contact_item_tpl" );
133 $person = new eZPerson( $personid );
134 $t->set_var( "person_lastname", eZTextTool::htmlspecialchars( $person->lastName() ) );
135 $t->set_var( "person_firstname", eZTextTool::htmlspecialchars( $person->firstName() ) );
136 $owner = new eZUser( $consultation->owner( -1, true ) );
137 }
138 $t->set_var( "owner", $owner->name() );
139 $t->set_var( "consultation_id", $ConsultationID );
140
141 $t->parse( "consultation_item", "consultation_item_tpl" );
142
143 // Create consultation types
144
145 $type = new eZConsultationType( $status_id );
146 $t->set_var( "status_name", eZTextTool::htmlspecialchars( $type->name() ) );
147
148 // Group list
149 $groups = $consultation->groupList();
150 foreach ( $groups as $group )
151 {
152 $t->set_var( "group_notice_name", eZTextTool::htmlspecialchars( $group->name() ) );
153 $t->parse( "group_notice_select", "group_notice_select_tpl", true );
154 }
155
156 if ( count( $groups ) == 0 )
157 {
158 $t->set_var( "group_notice_select", "" );
159 $t->parse( "no_group_notice", "no_group_notice_tpl" );
160 }
161 else
162 {
163 $t->set_var( "no_group_notice", "" );
164 }
165
166 // Template variabler.
167 $t->set_var( "action_value", $Action_value );
168 $t->pparse( "output", "consultation_view" );
169 }
170
171 ?>
$group
$group
Definition: admin/articleedit.php:799
$owner
$owner
Definition: bugedit.php:555
eZCompany
Definition: ezcompany.php:54
eZConsultationType
Definition: ezconsultationtype.php:54
eZConsultation
Definition: ezconsultation.php:60
eZConsultation\belongsTo
belongsTo( $consultationid, $user)
Definition: ezconsultation.php:380
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZPermission\checkPermission
static checkPermission( $user, $moduleName, $permissionName)
Definition: ezpermission.php:430
eZPerson
Definition: ezperson.php:43
eZTemplate
Definition: eztemplate.php:107
eZTextTool\htmlspecialchars
static htmlspecialchars( $string)
Definition: eztexttool.php:144
eZUser
Definition: ezuser.php:76
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
$company
if(!is_numeric( $Year)) if(!is_numeric( $Month)) if(!is_numeric( $Day)) $company
Definition: companystats.php:72
$Action_value
$Action_value
Definition: companyview.php:559
$status_id
if(! $user) $status_id
Definition: consultationview.php:97
$companyid
$companyid
Definition: consultationview.php:119
$groups
$groups
Definition: consultationview.php:149
$personid
$personid
Definition: consultationview.php:120
$user
$user
Definition: consultationview.php:41
$Language
$Language
Definition: consultationview.php:36
$ini
$ini
Definition: consultationview.php:35
$type
$type
Definition: consultationview.php:145
$t
if(!is_a( $user, "eZUser")) if(!eZPermission::checkPermission( $user, "eZContact", "Consultation") && $ini->variable("eZContactMain", "ShowAllConsultations") !="enabled") $t
Definition: consultationview.php:64
exit
exit
Definition: folder.php:81
$person
switch( $LimitType) $person
Definition: personlist.php:137
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.