function editclient($showmenu = false, $id = 0) { global $client_handler, $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $xoopsModule; include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; // If there is a parameter, and the id exists, retrieve data: we're editing a client if ($id != 0) { // Creating the client object $clientObj = new SmartclientClient($id); if ($clientObj->notLoaded()) { redirect_header("client.php", 1, _AM_SCLIENT_NOCLIENTSELECTED); exit; } switch ($clientObj->status()) { case _SCLIENT_STATUS_SUBMITTED: $breadcrumb_action1 = _AM_SCLIENT_SUBMITTED_CLIENTS; $breadcrumb_action2 = _AM_SCLIENT_APPROVING; $page_title = _AM_SCLIENT_SUBMITTED_TITLE; $page_info = _AM_SCLIENT_SUBMITTED_INFO; $button_caption = _AM_SCLIENT_APPROVE; $new_status = _SCLIENT_STATUS_ACTIVE; break; case _SCLIENT_STATUS_ACTIVE: $breadcrumb_action1 = _AM_SCLIENT_ACTIVE_CLIENTS; $breadcrumb_action2 = _AM_SCLIENT_EDITING; $page_title = _AM_SCLIENT_ACTIVE_EDITING; $page_info = _AM_SCLIENT_ACTIVE_EDITING_INFO; $button_caption = _AM_SCLIENT_MODIFY; $new_status = _SCLIENT_STATUS_ACTIVE; break; case _SCLIENT_STATUS_INACTIVE: $breadcrumb_action1 = _AM_SCLIENT_INACTIVE_CLIENTS; $breadcrumb_action2 = _AM_SCLIENT_EDITING; $page_title = _AM_SCLIENT_INACTIVE_EDITING; $page_info = _AM_SCLIENT_INACTIVE_EDITING_INFO; $button_caption = _AM_SCLIENT_MODIFY; $new_status = _SCLIENT_STATUS_INACTIVE; break; case _SCLIENT_STATUS_REJECTED: $breadcrumb_action1 = _AM_SCLIENT_REJECTED_CLIENTS; $breadcrumb_action2 = _AM_SCLIENT_EDITING; $page_title = _AM_SCLIENT_REJECTED_EDITING; $page_info = _AM_SCLIENT_REJECTED_EDITING_INFO; $button_caption = _AM_SCLIENT_MODIFY; $new_status = _SCLIENT_STATUS_REJECTED; break; case "default": default: break; } if ($showmenu) { smartclient_adminMenu(1, $breadcrumb_action1 . " > " . $breadcrumb_action2); } echo "<br />\n"; smartclient_collapsableBar('bottomtable', 'bottomtableicon'); echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a> " . $page_title . "</h3>"; echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . $page_info . "</span>"; echo "<div id='bottomtable'>"; } else { // there's no parameter, so we're adding a client $clientObj =& $client_handler->create(); $breadcrumb_action1 = _AM_SCLIENT_CLIENTS; $breadcrumb_action2 = _AM_SCLIENT_CREATE; $button_caption = _AM_SCLIENT_CREATE; $new_status = _SCLIENT_STATUS_ACTIVE; if ($showmenu) { smartclient_adminMenu(1, $breadcrumb_action1 . " > " . $breadcrumb_action2); } smartclient_collapsableBar('bottomtable', 'bottomtableicon'); echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a> " . _AM_SCLIENT_CLIENT_CREATING . "</h3>"; echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . _AM_SCLIENT_CLIENT_CREATING_DSC . "</span>"; echo "<div id='bottomtable'>"; } // CLIENT FORM $sform = new XoopsThemeForm(_AM_SCLIENT_CLIENTS, "op", xoops_getenv('PHP_SELF')); $sform->setExtra('enctype="multipart/form-data"'); // TITLE $title_text = new XoopsFormText(_CO_SCLIENT_TITLE_REQ, 'title', 50, 255, $clientObj->title('e')); $sform->addElement($title_text, true); // LOGO $logo_array =& XoopsLists::getImgListAsArray(smartclient_getImageDir()); $logo_select = new XoopsFormSelect('', 'image', $clientObj->image()); $logo_select->addOption('-1', '---------------'); $logo_select->addOptionArray($logo_array); $logo_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/' . SMARTCLIENT_DIRNAME . '/images' . "\", \"\", \"" . XOOPS_URL . "\")'"); $logo_tray = new XoopsFormElementTray(_AM_SCLIENT_LOGO, ' '); $logo_tray->addElement($logo_select); $logo_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . smartclient_getImageDir('', false) . $clientObj->image() . "' name='image3' id='image3' alt='' />")); $logo_tray->setDescription(_AM_SCLIENT_LOGO_DSC); $sform->addElement($logo_tray); // LOGO UPLOAD $max_size = 5000000; $file_box = new XoopsFormFile(_AM_SCLIENT_LOGO_UPLOAD, "logo_file", $max_size); $file_box->setExtra("size ='45'"); $file_box->setDescription(sprintf(_AM_SCLIENT_LOGO_UPLOAD_DSC, $xoopsModuleConfig['img_max_width'], $xoopsModuleConfig['img_max_height'])); $sform->addElement($file_box); // IMAGE_URL $image_url_text = new XoopsFormText(_CO_SCLIENT_IMAGE_URL, 'image_url', 50, 255, $clientObj->image_url()); $image_url_text->setDescription(_CO_SCLIENT_IMAGE_URL_DSC); $sform->addElement($image_url_text, false); // URL $url_text = new XoopsFormText(_AM_SCLIENT_URL, 'url', 50, 255, $clientObj->url()); $url_text->setDescription(_AM_SCLIENT_URL_DSC); $sform->addElement($url_text, false); // SUMMARY $summary_text = new XoopsFormTextArea(_AM_SCLIENT_SUMMARY_REQ, 'summary', $clientObj->summary(0, 'e'), 7, 60); $summary_text->setDescription(_AM_SCLIENT_SUMMARY_DSC); $sform->addElement($summary_text, true); // DESCRIPTION $description_text = new XoopsFormDhtmlTextArea(_AM_SCLIENT_DESCRIPTION, 'description', $clientObj->description(0, 'e'), 15, 60); $description_text->setDescription(_AM_SCLIENT_DESCRIPTION_DSC); $sform->addElement($description_text, false); // CONTACT_NAME $contact_name_text = new XoopsFormText(_CO_SCLIENT_CONTACT_NAME, 'contact_name', 50, 255, $clientObj->contact_name('e')); $contact_name_text->setDescription(_CO_SCLIENT_CONTACT_NAME_DSC); $sform->addElement($contact_name_text, false); // CONTACT_EMAIL $contact_email_text = new XoopsFormText(_CO_SCLIENT_CONTACT_EMAIL, 'contact_email', 50, 255, $clientObj->contact_email('e')); $contact_email_text->setDescription(_CO_SCLIENT_CONTACT_EMAIL_DSC); $sform->addElement($contact_email_text, false); // CONTACT_PHONE $contact_phone_text = new XoopsFormText(_CO_SCLIENT_CONTACT_PHONE, 'contact_phone', 50, 255, $clientObj->contact_phone('e')); $contact_phone_text->setDescription(_CO_SCLIENT_CONTACT_PHONE_DSC); $sform->addElement($contact_phone_text, false); // ADRESS //$adress_text = new XoopsFormText(_CO_SCLIENT_ADRESS, 'adress', 50, 255, $clientObj->adress('e')); $adress_text = new XoopsFormTextArea(_CO_SCLIENT_ADRESS, 'adress', $clientObj->adress('e')); $adress_text->setDescription(_CO_SCLIENT_ADRESS_DSC); $sform->addElement($adress_text, false); // STATUS $options = $clientObj->getAvailableStatus(); $status_select = new XoopsFormSelect(_AM_SCLIENT_STATUS, 'status', $new_status); $status_select->addOptionArray($options); $status_select->setDescription(_AM_SCLIENT_STATUS_DSC); $sform->addElement($status_select); // WEIGHT $weight_text = new XoopsFormText(_AM_SCLIENT_WEIGHT, 'weight', 4, 4, $clientObj->weight()); $weight_text->setDescription(_AM_SCLIENT_WEIGHT_DSC); $sform->addElement($weight_text); // Client id $sform->addElement(new XoopsFormHidden('id', $clientObj->id())); $button_tray = new XoopsFormElementTray('', ''); $hidden = new XoopsFormHidden('op', 'addclient'); $button_tray->addElement($hidden); $sform->addElement(new XoopsFormHidden('original_status', $clientObj->status())); if (!$id) { // there's no id? Then it's a new client // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SCLIENT_CREATE, 'submit' ) ); $butt_create = new XoopsFormButton('', '', _AM_SCLIENT_CREATE, 'submit'); $butt_create->setExtra('onclick="this.form.elements.op.value=\'addclient\'"'); $button_tray->addElement($butt_create); $butt_clear = new XoopsFormButton('', '', _AM_SCLIENT_CLEAR, 'reset'); $button_tray->addElement($butt_clear); $butt_cancel = new XoopsFormButton('', '', _AM_SCLIENT_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); } else { // else, we're editing an existing client // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SCLIENT_MODIFY, 'submit' ) ); $butt_create = new XoopsFormButton('', '', $button_caption, 'submit'); $butt_create->setExtra('onclick="this.form.elements.op.value=\'addclient\'"'); $button_tray->addElement($butt_create); $butt_cancel = new XoopsFormButton('', '', _AM_SCLIENT_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); } $sform->addElement($button_tray); $sform->display(); unset($hidden); echo "</div>"; }
// URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ // // Project: The XOOPS Project // // ------------------------------------------------------------------------- // include "header.php"; //error_reporting(0); //error_reporting(0); include_once 'header.php'; $myts =& MyTextSanitizer::getInstance(); require_once SMARTCLIENT_ROOT_PATH . 'fpdf/fpdf.inc.php'; $id = isset($_GET['id']) ? intval($_GET['id']) : 0; if ($id == 0) { redirect_header("javascript:history.go(-1)", 2, _MD_SCLIENT_NOCLIENTSELECTED); exit; } // Creating the Client object for the selected FAQ $clientObj = new SmartclientClient($id); // If the selected client was not found, exit if ($clientObj->notLoaded()) { redirect_header("javascript:history.go(-1)", 2, _MD_SCLIENT_NOCLIENTSELECTED); exit; } // Chech the status if ($clientObj->status() != _SCLIENT_STATUS_ACTIVE) { redirect_header("javascript:history.go(-1)", 2, _NOPERM); exit; } $pdf_data['title'] = $clientObj->title(); $pdf_data['subtitle'] = "subtitle..."; $pdf_data['subsubtitle'] = "subsubtitle..."; $pdf_data['date'] = "date..."; $pdf_data['filename'] = "filename...";
/** * retrieve Clients from the database * * @param object $criteria {@link CriteriaElement} conditions to be met * @param bool $id_as_key use the clientid as key for the array? * @return array array of {@link SmartclientClient} objects */ function &getObjects($criteria = null, $id_as_key = false) { $ret = false; $limit = $start = 0; $sql = 'SELECT * FROM ' . $this->_db->prefix($this->_dbtable); if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { $whereClause = $criteria->renderWhere(); if ($whereClause != 'WHERE ()') { $sql .= ' ' . $criteria->renderWhere(); if ($criteria->getSort() != '') { $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); } $limit = $criteria->getLimit(); $start = $criteria->getStart(); } } //echo "<br />" . $sql . "<br />"; $result = $this->_db->query($sql, $limit, $start); if (!$result) { return $ret; } if (count($result) == 0) { return $ret; } while ($myrow = $this->_db->fetchArray($result)) { $client = new SmartclientClient(); $client->assignVars($myrow); if (!$id_as_key) { $ret[] =& $client; } else { $ret[$myrow['id']] =& $client; } unset($client); } return $ret; }
<?php /** * $Id: vclient.php,v 1.4 2005/05/18 14:32:39 fx2024 Exp $ * Module: SmartClient * Author: The SmartFactory <www.smartfactory.ca> * Licence: GNU */ include "header.php"; $id = isset($_GET['id']) ? intval($_GET['id']) : 0; $clientObj = new SmartclientClient($id); if ($clientObj->notLoaded()) { redirect_header("javascript:history.go(-1)", 1, _CO_SCLIENT_NOCLIENTSELECTED); exit; } if ($clientObj->url()) { if (!isset($HTTP_COOKIE_VARS['clients'][$id])) { setcookie("clients[{$id}]", $id, $xoopsModuleConfig['cookietime']); $clientObj->updateHits(); } header("HTTP/1.1 301 Moved Permanently"); header("Location: " . $clientObj->url() . " "); exit; // echo "<html><head><meta http-equiv='Refresh' content='0; URL=".$clientObj->url()."'></head><body></body></html>"; } else { redirect_header("index.php", 1, _XP_NOPART); }
* Module: SmartClient * Author: The SmartFactory <www.smartfactory.ca> * Licence: GNU */ include_once "header.php"; $xoopsOption['template_main'] = 'smartclient_client.html'; include_once XOOPS_ROOT_PATH . "/header.php"; include_once "footer.php"; global $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $xoopsModule; $id = isset($_GET['id']) ? intval($_GET['id']) : 0; if ($id == 0) { redirect_header("javascript:history.go(-1)", 2, _MD_SCLIENT_NOCLIENTSELECTED); exit; } // Creating the Client object for the selected FAQ $clientObj = new SmartclientClient($id); // If the selected client was not found, exit if ($clientObj->notLoaded()) { redirect_header("javascript:history.go(-1)", 2, _MD_SCLIENT_NOCLIENTSELECTED); exit; } // Chech the status if ($clientObj->status() != _SCLIENT_STATUS_ACTIVE) { redirect_header("javascript:history.go(-1)", 2, _NOPERM); exit; } // Updating the counter $clientObj->updateHits_page(); // Populating the smarty variables with informations related to the selected Client $client = $clientObj->toArray(); $xoopsTpl->assign('client', $client);