Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

user/consultationlist.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: consultationlist.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 // include_once( "ezuser/classes/ezuser.php" );
28 // include_once( "ezuser/classes/ezusergroup.php" );
29 // include_once( "ezuser/classes/ezpermission.php" );
30
31 $ini =& eZINI::instance( 'site.ini' );
32
33 $user =& eZUser::currentUser();
34 if ( is_a( $user, "eZUser" ) &&
35 eZPermission::checkPermission( $user, "eZContact", "Consultation" ) )
36 {
37 // include_once( "ezcontact/classes/ezconsultation.php" );
38 // include_once( "ezcontact/classes/ezcompany.php" );
39 // include_once( "ezcontact/classes/ezperson.php" );
40
41 // include_once( "classes/INIFile.php" );
42 $max = $ini->variable( "eZContactMain", "LastConsultations" );
43 if ( !is_numeric( $max ) )
44 {
45 $max = 5;
46 }
47
48 $view_company = eZPermission::checkPermission( $user, "eZContact", "CompanyView" );
49 $view_person = eZPermission::checkPermission( $user, "eZContact", "PersonView" );
50
51 // include_once( "classes/INIFile.php" );
52
53 $Language = $ini->variable( "eZContactMain", "Language" );
54
55 // include_once( "classes/eztemplate.php" );
56
57 $t = new eZTemplate( "kernel/ezcontact/user/" . $ini->variable( "eZContactMain", "TemplateDir" ),
58 "kernel/ezcontact/user/intl", $Language, "menubox.php" );
59
60 $t->setAllStrings();
61
62 $t->set_file( "consultation_tpl", "consultation.tpl" );
63
64 $t->set_block( "consultation_tpl", "last_consultations_item_tpl", "last_consultations_item" );
65 $t->set_block( "last_consultations_item_tpl", "consultation_item_tpl", "consultation_item" );
66
67 $t->set_block( "consultation_item_tpl", "consultation_person_item_tpl", "consultation_person_item" );
68 $t->set_block( "consultation_item_tpl", "consultation_no_person_item_tpl", "consultation_no_person_item" );
69 $t->set_block( "consultation_item_tpl", "consultation_company_item_tpl", "consultation_company_item" );
70 $t->set_block( "consultation_item_tpl", "consultation_no_company_item_tpl", "consultation_no_company_item" );
71
72 $t->set_var( "consultation_item", "" );
73 $t->set_var( "last_consultations_item", "" );
74
75 if ( $ini->variable( "eZContactMain", "ShowAllConsultations" ) == "enabled" )
76 {
77 if ( $ini->variable( "eZContactMain", "ShowRelatedConsultations" ) == "enabled" )
78 $consultations = eZConsultation::findLatestConsultations( -1, $max, "ID", true, 0, -1, true );
79 else
80 $consultations = eZConsultation::findLatestConsultations( -1, $max );
81 }
82 else
83 {
84 if ( $ini->variable( "eZContactMain", "ShowRelatedConsultations" ) == "enabled" )
85 $consultations = eZConsultation::findLatestConsultations( $user->id(), $max, "ID", true, 0, -1, true );
86 else
87 $consultations = eZConsultation::findLatestConsultations( $user->id(), $max );
88 }
89
90 foreach ( $consultations as $consultation )
91 {
92 $t->set_var( "consultation_desc", $consultation->shortDescription() );
93 $t->set_var( "consultation_id", $consultation->id() );
94 $company_id = $consultation->company( $user->id() );
95 $t->set_var( "consultation_company_item", "" );
96 $t->set_var( "consultation_no_company_item", "" );
97 $t->set_var( "consultation_person_item", "" );
98 $t->set_var( "consultation_no_person_item", "" );
99 if ( $company_id )
100 {
101 $company = new eZCompany( $company_id );
102 $t->set_var( "contact_name", $company->name() );
103 $t->set_var( "company_id", $company->id() );
104 if ( $view_company )
105 $t->parse( "consultation_company_item", "consultation_company_item_tpl" );
106 else
107 $t->parse( "consultation_no_company_item", "consultation_no_company_item_tpl" );
108 }
109 else
110 {
111 $person_id = $consultation->person( $user->id() );
112 if ( $person_id )
113 {
114 $person = new eZPerson( $person_id );
115 $t->set_var( "person_id", $person->id() );
116 $t->set_var( "contact_lastname", $person->lastName() );
117 $t->set_var( "contact_firstname", $person->firstName() );
118 if ( $view_person )
119 $t->parse( "consultation_person_item", "consultation_person_item_tpl" );
120 else
121 $t->parse( "consultation_no_person_item", "consultation_no_person_item_tpl" );
122 }
123 else
124 {
125 }
126 }
127 $t->parse( "consultation_item", "consultation_item_tpl", true );
128 }
129
130 if ( count( $consultations ) > 0 )
131 {
132 $t->parse( "last_consultations_item", "last_consultations_item_tpl" );
133 }
134
135 $t->pparse( "output", "consultation_tpl" );
136 }
137
138 ?>
eZCompany
Definition: ezcompany.php:54
eZConsultation\findLatestConsultations
static findLatestConsultations( $user, $max)
Definition: ezconsultation.php:637
eZPermission\checkPermission
static checkPermission( $user, $moduleName, $permissionName)
Definition: ezpermission.php:430
eZPerson
Definition: ezperson.php:43
eZTemplate
Definition: eztemplate.php:107
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
$t
foreach( $Modules as $module) if(isset( $ItemInsert)) $t
Definition: classes/admin/linklist.php:168
$Language
$Language
Definition: classes/admin/linklist.php:65
$company
if(!is_numeric( $Year)) if(!is_numeric( $Month)) if(!is_numeric( $Day)) $company
Definition: companystats.php:72
$person
switch( $LimitType) $person
Definition: personlist.php:137
$user
$user
Definition: user/consultationlist.php:33
$ini
$ini
Definition: user/consultationlist.php:31
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.