Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

link.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: link.php 6478 2001-08-17 08:43:49Z jhe $
5 //
6 // Created on: <17-Aug-2001 09:06:39 jhe>
7 //
8 // This source file is part of Exponential Basic, publishing software.
9 // Copyright (C) 1999-2001 eZ systems as
10 //
11 // This program is free software; you can redistribute it and/or
12 // modify it under the terms of the GNU General Public License
13 // as published by the Free Software Foundation; either version 2
14 // of the License, or (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
24 //
25
26 // include_once( "classes/eztexttool.php" );
27 // include_once( "classes/eztemplate.php" );
28 // include_once( "ezcontact/classes/ezperson.php" );
29 // include_once( "ezcontact/classes/ezcompany.php" );
30 // include_once( "ezcontact/classes/ezcompanytype.php" );
31 // include_once( "ezmail/classes/ezmail.php" );
32
33 if ( isset( $Back ) )
34 {
35 // include_once( "classes/ezhttptool.php" );
36 eZHTTPTool::header( "Location: /mail/view/$MailID" );
37 exit();
38 }
39
40 if ( isset( $OK ) )
41 {
42 eZMail::removeContacts( $MailID );
43 foreach ( $CompanyID as $company )
44 {
45 if ( $company > -1 )
46 eZMail::addContact( $MailID, $company, true );
47 }
48 foreach ( $PersonID as $person )
49 {
50 if ( $person > -1 )
51 eZMail::addContact( $MailID, $person, false );
52 }
53 // include_once( "classes/ezhttptool.php" );
54 eZHTTPTool::header( "Location: /mail/view/$MailID" );
55 exit();
56 }
57
58 $ini =& eZINI::instance( 'site.ini' );
59 $Language = $ini->variable( "eZMailMain", "Language" );
60
61 $t = new eZTemplate( "kernel/ezmail/user/" . $ini->variable( "eZMailMain", "TemplateDir" ),
62 "kernel/ezmail/user/intl/", $Language, "link.php" );
63 $t->setAllStrings();
64
65 $t->set_file( "mail_link_page_tpl", "link.tpl" );
66
67 $t->set_block( "mail_link_page_tpl", "company_list_tpl", "company_list" );
68 $t->set_block( "company_list_tpl", "company_select_tpl", "company_select" );
69 $t->set_block( "mail_link_page_tpl", "person_list_tpl", "person_list" );
70 $t->set_block( "person_list_tpl", "person_select_tpl", "person_select" );
71
72 $t->set_var( "mail_id", $MailID );
73
74 $top_name = $t->get_var( "intl-top_category" );
75 if ( !is_string( $top_name ) )
76 $top_name = "";
77 $companyTypeList = eZCompanyType::getTree( 0, 0, true, $top_name );
78 $categoryList = array();
79
80 if ( !isset( $PersonID ) )
81 $PersonID = false;
82
83
84 $categoryList = eZPerson::companies( $PersonID, false );
85 $category_values = (new eZMail())->getContacts( $MailID );
86 $t->set_var( "is_top_selected", in_array( 0, $category_values ) ? "selected" : "" );
87 foreach ( $companyTypeList as $companyTypeItem )
88 {
89 $t->set_var( "company_name", "[" . eZTextTool::htmlspecialchars( $companyTypeItem[0]->name() ) . "]" );
90 $t->set_var( "company_id", "-1" );
91
92 $level = $companyTypeItem[1] > 0 ? str_repeat( "&nbsp;", $companyTypeItem[1] ) : "";
93 $t->set_var( "company_level", $level );
94 $t->set_var( "is_selected", "" );
95 $t->parse( "company_select", "company_select_tpl", true );
96
97 $level = str_repeat( "&nbsp;", $companyTypeItem[1] + 1 );
98 $t->set_var( "company_level", $level );
99
100 $companies = eZCompany::getByCategory( $companyTypeItem[0]->id() );
101 foreach ( $companies as $companyItem )
102 {
103 $t->set_var( "company_name", eZTextTool::htmlspecialchars( $companyItem->name() ) );
104 $t->set_var( "company_id", $companyItem->id() );
105 $t->set_var( "is_selected", in_array( $companyItem->id(), $category_values["CompanyID"] )
106 ? "selected" : "" );
107 $t->parse( "company_select", "company_select_tpl", true );
108 }
109 }
110
111 if ( count( $companyTypeList ) > 0 )
112 {
113 $t->parse( "company_list", "company_list_tpl" );
114 }
115 else
116 {
117 $t->set_var( "company_list", "" );
118 }
119 $personList =& (new eZPerson())->getAll();
120
121 foreach ( $personList as $person )
122 {
123 $t->set_var( "person_name", eZTextTool::htmlspecialchars( $person->name() ) );
124 $t->set_var( "person_id", $person->id() );
125 $t->set_var( "person_is_selected", in_array( $person->id(), $category_values["PersonID"] )
126 ? "selected" : "" );
127 $t->parse( "person_select", "person_select_tpl", true );
128 }
129
130 if ( count( $personList ) > 0 )
131 {
132 $t->parse( "person_list", "person_list_tpl" );
133 }
134 else
135 {
136 $t->set_var( "person_list", "" );
137 }
138
139
140 $t->pparse( "output", "mail_link_page_tpl" );
141
142 ?>
$companies
else $companies
Definition: admin/consultationlist.php:221
$level
$level
Definition: admin/message.php:106
eZCompany\getByCategory
& getByCategory( $categoryID, $offset=0, $limit=-1, $order="name")
Definition: ezcompany.php:277
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZMail
Definition: ezmail.php:57
eZMail\removeContacts
removeContacts( $mailID)
Definition: ezmail.php:171
eZMail\addContact
addContact( $mailID, $contactID, $companyEdit=true)
Definition: ezmail.php:179
eZPerson
Definition: ezperson.php:43
eZPerson\companies
static companies( $id=false, $as_object=true)
Definition: ezperson.php:1028
eZTemplate
Definition: eztemplate.php:107
eZTextTool\htmlspecialchars
static htmlspecialchars( $string)
Definition: eztexttool.php:144
$company
if(!is_numeric( $Year)) if(!is_numeric( $Month)) if(!is_numeric( $Day)) $company
Definition: companystats.php:72
exit
exit
Definition: folder.php:81
$personList
$personList
Definition: link.php:119
$ini
if(isset( $Back)) if(isset( $OK)) $ini
Definition: link.php:58
$category_values
$category_values
Definition: link.php:85
$t
$t
Definition: link.php:61
$Language
$Language
Definition: link.php:59
$companyTypeList
$companyTypeList
Definition: link.php:77
$categoryList
$categoryList
Definition: link.php:78
$top_name
$top_name
Definition: link.php:74
$person
switch( $LimitType) $person
Definition: personlist.php:137
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.