|
From: <dts...@us...> - 2003-05-28 21:31:20
|
Update of /cvsroot/phpwebsite-comm/modules/contacts/class
In directory sc8-pr-cvs1:/tmp/cvs-serv29539/class
Modified Files:
AddressType.php Country.php Manager.php PhoneType.php
Log Message:
Got phone types and address types going
Index: AddressType.php
===================================================================
RCS file: /cvsroot/phpwebsite-comm/modules/contacts/class/AddressType.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** AddressType.php 28 May 2003 18:01:11 -0000 1.1
--- AddressType.php 28 May 2003 21:31:10 -0000 1.2
***************
*** 7,10 ****
--- 7,188 ----
class CONTACTS_AddressType extends PHPWS_Item {
+ /**
+ * The name of the addresstype
+ *
+ * @var string
+ * @access private
+ */
+ var $_name = NULL;
+
+ /**
+ * The abbreviation/code of the addresstype
+ *
+ * @var string
+ * @access private
+ */
+ var $_abbreviation = NULL;
+
+
+ function CONTACTS_AddressType($ADDRESSTYPE_ID = NULL) {
+ /* These vars are excluded on commit() */
+ // $exclude = array();
+ // $this->addExclude($exclude);
+
+ $this->setTable("mod_contacts_addresstypes");
+
+ if(isset($ADDRESSTYPE_ID)) {
+ $this->setId($ADDRESSTYPE_ID);
+ $this->init();
+ }
+ }// END FUNC CONTACTS_AddressType
+
+
+ function _edit() {
+ // Need to see if the userid matches the object owner
+ if(!$_SESSION["OBJ_user"]->allow_access("contacts","edit_addresstypes")) {
+ $message = $_SESSION["translate"]->it("Access to edit address types was denied due to lack of proper permissions.");
+ $error = new PHWPS_Error("contacts", "CONTACTS_AddressType::_edit()", $message, "exit", 1);
+ $error->message();
+ return FALSE;
+ }
+
+ /* Create form */
+ $form = new EZform("CONTACTS_AddressType_edit");
+
+ /* AddressType Name */
+ $form->add("AddressType_name", "text", $this->_name);
+ $form->setSize("AddressType_name", 33);
+ $form->setTab("AddressType_name", 1);
+
+ /* AddressType Abbreviation */
+ $form->add("AddressType_abbreviation", "text", $this->_abbreviation);
+ $form->setSize("AddressType_abbreviation", 5);
+ $form->setTab("AddressType_abbreviation", 2);
+
+ /* Save Button */
+ $form->add("AddressType_save", "submit", $_SESSION["translate"]->it("Save"));
+ $form->setTab("AddressType_save", 3);
+
+ /* Module Information */
+ $form->add("module", "hidden", "contacts");
+ $form->add("CONTACTS_AddressType_OP", "hidden", "save");
+
+ $tags = array();
+ $tags = $form->getTemplate();
+
+ $tags["NAME_TEXT"] = $_SESSION["translate"]->it("Address Type Name");
+ $tags["ABBREVIATION_TEXT"] = $_SESSION["translate"]->it("Abbreviation");
+
+ return $GLOBALS["core"]->processTemplate($tags, "contacts", "edit_addresstypes.tpl");
+
+ }// END FUNC _edit
+
+
+ function _save() {
+ if(!$_SESSION["OBJ_user"]->allow_access("contacts", "edit_addresstypes")) {
+ $message = $_SESSION["translate"]->it("Access to save address types was denied due to lack of proper permissions.");
+ $error = new PHWPS_Error("contacts", "CONTACTS_AddressType::_save()", $message, "exit", 1);
+ $error->message();
+ return FALSE;
+ }
+
+ if(isset($_REQUEST["AddressType_name"]))
+ $this->_name = $_REQUEST["AddressType_name"];
+
+ $this->setLabel($this->_name);
+
+ if(isset($_REQUEST["AddressType_abbreviation"]))
+ $this->_abbreviation = $_REQUEST["AddressType_abbreviation"];
+
+ $error = $this->commit();
+
+ if(PHPWS_Error::isError($error)) {
+ $message = $_SESSION["translate"]->it("The address type could not be saved to the database.");
+ $error = new PHPWS_Error("contacts", $message, "continue", 0);
+ $error->message("CNT_contacts");
+
+ $_REQUEST["CONTACTS_AddressType_OP"] = "edit";
+ $this->action();
+ return;
+ } else {
+ $GLOBALS["CNT_contacts"]["content"] .= $_SESSION["translate"]->it("The address type was successfully saved.") . "<br />\n";
+ $_REQUEST["CONTACTS_MAN_OP"] = "listaddresstypes";
+ $_SESSION["CONTACTS_Manager"]->action();
+ }
+ }// END FUNC _save
+
+
+ function _delete() {
+ if(!$_SESSION["OBJ_user"]->allow_access("contacts", "delete_addresstypes")) {
+ $message = $_SESSION["translate"]->it("Access to delete address type was denied due to lack of proper permissions.");
+ $error = new PHWPS_Error("contacts", "CONTACTS_AddressType::_delete()", $message, "exit", 1);
+ $error->message();
+ return FALSE;
+ }
+
+ if(isset($_REQUEST["AddressType_yes"])) {
+ $this->kill();
+ $message = $_SESSION["translate"]->it("The address type [var1] was successfully deleted from the database.", "<b><i>" . $this->getLabel() . "</i></b>");
+ $_SESSION["CONTACTS_Manager"]->message = new PHPWS_Message($message, "CNT_contacts");
+ $_REQUEST["CONTACTS_MAN_OP"] = "listaddresstypes";
+ $_SESSION["CONTACTS_Manager"]->action();
+
+ } elseif(isset($_REQUEST["AddressType_no"])) {
+ $message = $_SESSION["translate"]->it("No address type was deleted from the database.");
+ $_SESSION["CONTACTS_Manager"]->message = new PHPWS_Message($message, "CNT_contacts");
+ $_REQUEST["CONTACTS_MAN_OP"] = "listaddresstypes";
+ $_SESSION["CONTACTS_Manager"]->action();
+
+ } else {
+ $title = $_SESSION["translate"]->it("Delete Address Type Confirmation");
+
+ $form = new EZform("CONTACTS_AddressType_delete");
+ $form->add("module", "hidden", "contacts");
+ $form->add("CONTACTS_AddressType_OP", "hidden", "delete");
+
+ $form->add("AddressType_yes", "submit", $_SESSION["translate"]->it("Yes"));
+ $form->add("AddressType_no", "submit", $_SESSION["translate"]->it("No"));
+
+ $tags = array();
+ $tags = $form->getTemplate();
+ $tags["MESSAGE"] = $_SESSION["translate"]->it("Are you sure you want to delete this address type?");
+
+ $content = $GLOBALS["core"]->processTemplate($tags, "contacts", "delete_addresstypes.tpl");
+ $_SESSION["OBJ_layout"]->popbox($title, $content, NULL, "CNT_contacts");
+ }
+
+ }// END FUNC _delete
+
+
+ function action() {
+ switch($_REQUEST["CONTACTS_AddressType_OP"]) {
+ case "edit":
+ if(isset($this->_id))
+ $title = $_SESSION["translate"]->it("Edit Address Type");
+ else
+ $title = $_SESSION["translate"]->it("New Address Type");
+ $content = $this->_edit();
+ break;
+
+ case "save":
+ $this->_save();
+ break;
+
+ case "delete":
+ $this->_delete();
+ break;
+
+ default:
+ $title = "NO OP";
+ $content = "This function is not yet implemented.";
+ }
+
+ if(isset($content)) {
+ $GLOBALS["CNT_contacts"]["title"] = $title;
+ $GLOBALS["CNT_contacts"]["content"] = $content;
+ }
+ }// END FUNC action
+
+
}// END CLASS CONTACTS_AddressType
Index: Country.php
===================================================================
RCS file: /cvsroot/phpwebsite-comm/modules/contacts/class/Country.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Country.php 28 May 2003 20:34:52 -0000 1.3
--- Country.php 28 May 2003 21:31:11 -0000 1.4
***************
*** 129,133 ****
} elseif(isset($_REQUEST["Country_no"])) {
! $message = $_SESSION["translate"]->it("No country was deleted fromt he database.");
$_SESSION["CONTACTS_Manager"]->message = new PHPWS_Message($message, "CNT_contacts");
$_REQUEST["CONTACTS_MAN_OP"] = "listcountries";
--- 129,133 ----
} elseif(isset($_REQUEST["Country_no"])) {
! $message = $_SESSION["translate"]->it("No country was deleted from the database.");
$_SESSION["CONTACTS_Manager"]->message = new PHPWS_Message($message, "CNT_contacts");
$_REQUEST["CONTACTS_MAN_OP"] = "listcountries";
Index: Manager.php
===================================================================
RCS file: /cvsroot/phpwebsite-comm/modules/contacts/class/Manager.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Manager.php 28 May 2003 20:34:52 -0000 1.3
--- Manager.php 28 May 2003 21:31:11 -0000 1.4
***************
*** 60,63 ****
--- 60,64 ----
$GLOBALS["CNT_contacts"]["title"] = $_SESSION["translate"]->it("Phone Types");
$GLOBALS["CNT_contacts"]["content"] .= $this->_menu();
+ $GLOBALS["CNT_contacts"]["content"] .= "<a href=\"index.php?module=contacts&CONTACTS_MAN_OP=newphonetype\">" . $_SESSION["translate"]->it("New Phone Type") . "</a>";
$GLOBALS["CNT_contacts"]["content"] .= $this->getList("phonetypes");
}// END FUNC _listPhoneTypes
***************
*** 68,71 ****
--- 69,73 ----
$GLOBALS["CNT_contacts"]["title"] = $_SESSION["translate"]->it("Address Types");
$GLOBALS["CNT_contacts"]["content"] .= $this->_menu();
+ $GLOBALS["CNT_contacts"]["content"] .= "<a href=\"index.php?module=contacts&CONTACTS_MAN_OP=newaddresstype\">" . $_SESSION["translate"]->it("New Address Type") . "</a>";
$GLOBALS["CNT_contacts"]["content"] .= $this->getList("addresstypes");
}// END FUNC _listAddressTypes
***************
*** 99,103 ****
$this->country = new CONTACTS_Country($_REQUEST["PHPWS_MAN_ITEMS"][0]);
$_REQUEST["CONTACTS_Country_OP"] = "delete";
! }// END FUNC _editCountry
--- 101,141 ----
$this->country = new CONTACTS_Country($_REQUEST["PHPWS_MAN_ITEMS"][0]);
$_REQUEST["CONTACTS_Country_OP"] = "delete";
! }// END FUNC _deleteCountries
!
!
! function _newAddressType() {
! $this->addresstype = new CONTACTS_AddressType;
! $_REQUEST["CONTACTS_AddressType_OP"] = "edit";
! }// END FUNC _newAddressType
!
!
! function _editAddressType() {
! $this->addresstype = new CONTACTS_AddressType($_REQUEST["PHPWS_MAN_ITEMS"][0]);
! $_REQUEST["CONTACTS_AddressType_OP"] = "edit";
! }// END FUNC _editAddressType
!
!
! function _deleteAddressType() {
! $this->addresstype = new CONTACTS_AddressType($_REQUEST["PHPWS_MAN_ITEMS"][0]);
! $_REQUEST["CONTACTS_AddressType_OP"] = "delete";
! }// END FUNC _editAddressType
!
!
! function _newPhoneType() {
! $this->phonetype = new CONTACTS_PhoneType;
! $_REQUEST["CONTACTS_PhoneType_OP"] = "edit";
! }// END FUNC _newPhoneType
!
!
! function _editPhoneType() {
! $this->phonetype = new CONTACTS_PhoneType($_REQUEST["PHPWS_MAN_ITEMS"][0]);
! $_REQUEST["CONTACTS_PhoneType_OP"] = "edit";
! }// END FUNC _editPhoneType
!
!
! function _deletePhoneType() {
! $this->phonetype = new CONTACTS_PhoneType($_REQUEST["PHPWS_MAN_ITEMS"][0]);
! $_REQUEST["CONTACTS_PhoneType_OP"] = "delete";
! }// END FUNC _editPhoneType
***************
*** 135,141 ****
--- 173,204 ----
break;
+ case "newphonetype":
+ $this->_newPhoneType();
+ break;
+
+ case "editphonetypes":
+ $this->_editPhoneType();
+ break;
+
+ case "deletephonetypes":
+ $this->_deletePhoneType();
+ break;
+
case "listaddresstypes":
$this->_listAddressTypes();
break;
+
+ case "newaddresstype":
+ $this->_newAddressType();
+ break;
+
+ case "editaddresstypes":
+ $this->_editAddressType();
+ break;
+
+ case "deleteaddresstypes":
+ $this->_deleteAddressType();
+ break;
+
}
}// END FUNC action
Index: PhoneType.php
===================================================================
RCS file: /cvsroot/phpwebsite-comm/modules/contacts/class/PhoneType.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PhoneType.php 28 May 2003 18:01:11 -0000 1.1
--- PhoneType.php 28 May 2003 21:31:11 -0000 1.2
***************
*** 7,10 ****
--- 7,188 ----
class CONTACTS_PhoneType extends PHPWS_Item {
+ /**
+ * The name of the phonetype
+ *
+ * @var string
+ * @access private
+ */
+ var $_name = NULL;
+
+ /**
+ * The abbreviation/code of the phonetype
+ *
+ * @var string
+ * @access private
+ */
+ var $_abbreviation = NULL;
+
+
+ function CONTACTS_PhoneType($PHONETYPE_ID = NULL) {
+ /* These vars are excluded on commit() */
+ // $exclude = array();
+ // $this->addExclude($exclude);
+
+ $this->setTable("mod_contacts_phonetypes");
+
+ if(isset($PHONETYPE_ID)) {
+ $this->setId($PHONETYPE_ID);
+ $this->init();
+ }
+ }// END FUNC CONTACTS_PhoneType
+
+
+ function _edit() {
+ // Need to see if the userid matches the object owner
+ if(!$_SESSION["OBJ_user"]->allow_access("contacts","edit_phonetypes")) {
+ $message = $_SESSION["translate"]->it("Access to edit phone types was denied due to lack of proper permissions.");
+ $error = new PHWPS_Error("contacts", "CONTACTS_PhoneType::_edit()", $message, "exit", 1);
+ $error->message();
+ return FALSE;
+ }
+
+ /* Create form */
+ $form = new EZform("CONTACTS_PhoneType_edit");
+
+ /* PhoneType Name */
+ $form->add("PhoneType_name", "text", $this->_name);
+ $form->setSize("PhoneType_name", 33);
+ $form->setTab("PhoneType_name", 1);
+
+ /* PhoneType Abbreviation */
+ $form->add("PhoneType_abbreviation", "text", $this->_abbreviation);
+ $form->setSize("PhoneType_abbreviation", 5);
+ $form->setTab("PhoneType_abbreviation", 2);
+
+ /* Save Button */
+ $form->add("PhoneType_save", "submit", $_SESSION["translate"]->it("Save"));
+ $form->setTab("PhoneType_save", 3);
+
+ /* Module Information */
+ $form->add("module", "hidden", "contacts");
+ $form->add("CONTACTS_PhoneType_OP", "hidden", "save");
+
+ $tags = array();
+ $tags = $form->getTemplate();
+
+ $tags["NAME_TEXT"] = $_SESSION["translate"]->it("Phone Type Name");
+ $tags["ABBREVIATION_TEXT"] = $_SESSION["translate"]->it("Abbreviation");
+
+ return $GLOBALS["core"]->processTemplate($tags, "contacts", "edit_phonetypes.tpl");
+
+ }// END FUNC _edit
+
+
+ function _save() {
+ if(!$_SESSION["OBJ_user"]->allow_access("contacts", "edit_phonetypes")) {
+ $message = $_SESSION["translate"]->it("Access to save phone types was denied due to lack of proper permissions.");
+ $error = new PHWPS_Error("contacts", "CONTACTS_PhoneType::_save()", $message, "exit", 1);
+ $error->message();
+ return FALSE;
+ }
+
+ if(isset($_REQUEST["PhoneType_name"]))
+ $this->_name = $_REQUEST["PhoneType_name"];
+
+ $this->setLabel($this->_name);
+
+ if(isset($_REQUEST["PhoneType_abbreviation"]))
+ $this->_abbreviation = $_REQUEST["PhoneType_abbreviation"];
+
+ $error = $this->commit();
+
+ if(PHPWS_Error::isError($error)) {
+ $message = $_SESSION["translate"]->it("The phone type could not be saved to the database.");
+ $error = new PHPWS_Error("contacts", $message, "continue", 0);
+ $error->message("CNT_contacts");
+
+ $_REQUEST["CONTACTS_PhoneType_OP"] = "edit";
+ $this->action();
+ return;
+ } else {
+ $GLOBALS["CNT_contacts"]["content"] .= $_SESSION["translate"]->it("The phone type was successfully saved.") . "<br />\n";
+ $_REQUEST["CONTACTS_MAN_OP"] = "listphonetypes";
+ $_SESSION["CONTACTS_Manager"]->action();
+ }
+ }// END FUNC _save
+
+
+ function _delete() {
+ if(!$_SESSION["OBJ_user"]->allow_access("contacts", "delete_phonetypes")) {
+ $message = $_SESSION["translate"]->it("Access to delete phone type was denied due to lack of proper permissions.");
+ $error = new PHWPS_Error("contacts", "CONTACTS_PhoneType::_delete()", $message, "exit", 1);
+ $error->message();
+ return FALSE;
+ }
+
+ if(isset($_REQUEST["PhoneType_yes"])) {
+ $this->kill();
+ $message = $_SESSION["translate"]->it("The phone type [var1] was successfully deleted from the database.", "<b><i>" . $this->getLabel() . "</i></b>");
+ $_SESSION["CONTACTS_Manager"]->message = new PHPWS_Message($message, "CNT_contacts");
+ $_REQUEST["CONTACTS_MAN_OP"] = "listphonetypes";
+ $_SESSION["CONTACTS_Manager"]->action();
+
+ } elseif(isset($_REQUEST["PhoneType_no"])) {
+ $message = $_SESSION["translate"]->it("No phone type was deleted from the database.");
+ $_SESSION["CONTACTS_Manager"]->message = new PHPWS_Message($message, "CNT_contacts");
+ $_REQUEST["CONTACTS_MAN_OP"] = "listphonetypes";
+ $_SESSION["CONTACTS_Manager"]->action();
+
+ } else {
+ $title = $_SESSION["translate"]->it("Delete Phone Type Confirmation");
+
+ $form = new EZform("CONTACTS_PhoneType_delete");
+ $form->add("module", "hidden", "contacts");
+ $form->add("CONTACTS_PhoneType_OP", "hidden", "delete");
+
+ $form->add("PhoneType_yes", "submit", $_SESSION["translate"]->it("Yes"));
+ $form->add("PhoneType_no", "submit", $_SESSION["translate"]->it("No"));
+
+ $tags = array();
+ $tags = $form->getTemplate();
+ $tags["MESSAGE"] = $_SESSION["translate"]->it("Are you sure you want to delete this phone type?");
+
+ $content = $GLOBALS["core"]->processTemplate($tags, "contacts", "delete_phonetypes.tpl");
+ $_SESSION["OBJ_layout"]->popbox($title, $content, NULL, "CNT_contacts");
+ }
+
+ }// END FUNC _delete
+
+
+ function action() {
+ switch($_REQUEST["CONTACTS_PhoneType_OP"]) {
+ case "edit":
+ if(isset($this->_id))
+ $title = $_SESSION["translate"]->it("Edit Phone Type");
+ else
+ $title = $_SESSION["translate"]->it("New Phone Type");
+ $content = $this->_edit();
+ break;
+
+ case "save":
+ $this->_save();
+ break;
+
+ case "delete":
+ $this->_delete();
+ break;
+
+ default:
+ $title = "NO OP";
+ $content = "This function is not yet implemented.";
+ }
+
+ if(isset($content)) {
+ $GLOBALS["CNT_contacts"]["title"] = $title;
+ $GLOBALS["CNT_contacts"]["content"] = $content;
+ }
+ }// END FUNC action
+
+
}// END CLASS CONTACTS_PhoneType
|