本文整理汇总了PHP中Db::runQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP Db::runQuery方法的具体用法?PHP Db::runQuery怎么用?PHP Db::runQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Db
的用法示例。
在下文中一共展示了Db::runQuery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getlastThread
public function getlastThread($topic_id)
{
global $mySession;
$db = new Db();
$forumThread = $db->runQuery("select * from " . FORUM_THREADS . " inner join " . USERS . " on " . USERS . ".user_id = " . FORUM_THREADS . ".user_id where topic_id=" . $topic_id . " order by thread_id desc limit 1");
return $forumThread;
}
示例2: init
public function init()
{
global $mySession;
$db = new Db();
$ConfigData = $db->runQuery("select * from " . ADMINISTRATOR . " where admin_id='1'");
$SiteTitle = $ConfigData[0]['site_title'];
$MetaDescription = $ConfigData[0]['site_description'];
$MetaKeyword = $ConfigData[0]['site_keyword'];
$AdminEmail = $ConfigData[0]['admin_email'];
$PaypalEmail = $ConfigData[0]['paypal_email'];
$welcomemessageC = $ConfigData[0]['welcomemessage'];
$admin_name_value = $ConfigData[0]['admin_fullname'];
$site_title = new Zend_Form_Element_Text('site_title');
$site_title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Site title is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($SiteTitle);
$admin_name = new Zend_Form_Element_Text('admin_name');
$admin_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Admin name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($admin_name_value);
$site_description = new Zend_Form_Element_Text('site_description');
$site_description->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Site description is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($MetaDescription);
$site_keyword = new Zend_Form_Element_Text('site_keyword');
$site_keyword->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Site keyword is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($MetaKeyword);
$admin_email = new Zend_Form_Element_Text('admin_email');
$admin_email->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Administrator email is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required email")->setValue($AdminEmail);
$paypal_email = new Zend_Form_Element_Text('paypal_email');
$paypal_email->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Paypal email address is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required email")->setValue($PaypalEmail);
/*$currency_symbol= new Zend_Form_Element_Text('currency_symbol');
$currency_symbol->setRequired(true)
->addValidator('NotEmpty',true,array('messages' =>'Currency symbol is required.'))
->addDecorator('Errors', array('class'=>'error'))
->setAttrib("class","required")
->setValue($CurrencySymbol);*/
$welcomemessage = new Zend_Form_Element_Textarea('welcomemessage');
$welcomemessage->setAttrib("id", "elrte")->setAttrib("cols", "auto")->setAttrib("rows", "auto")->setValue($welcomemessageC);
$this->addElements(array($site_title, $admin_name, $site_description, $site_keyword, $admin_email, $paypal_email, $welcomemessage));
}
示例3: saveProtype
public function saveProtype($dataForm, $ptyleId = "")
{
global $mySession;
$db = new Db();
$data_update['ptyle_name'] = $dataForm['ptyle_name'];
if ($ptyleId == "") {
$chkQry = $db->runQuery("select * from " . PROPERTYTYPE . " where ptyle_name='" . mysql_escape_string(trim($dataForm['ptyle_name'])) . "'");
if ($chkQry != "" and count($chkQry) > 0) {
//if Property Type Name is exists than return false / 0
// No Data Inserted
return 0;
} else {
# If Property Type Name Not Already Exista.
# Insert New Record Into Database
$db->save(PROPERTYTYPE, $data_update);
return 1;
}
} else {
$chkQry = $db->runQuery("select * from " . PROPERTYTYPE . " where ptyle_name='" . mysql_escape_string(trim($dataForm['ptyle_name'])) . "' and ptyle_id!=" . $ptyleId);
if ($chkQry != "" and count($chkQry) > 0) {
return 0;
} else {
$condition = 'ptyle_id=' . $ptyleId;
$result = $db->modify(PROPERTYTYPE, $data_update, $condition);
return 1;
}
}
}
示例4: init
public function init($stateId)
{
global $mySession;
$db = new Db();
$CountryId = "";
$StateName = "";
if ($stateId != "") {
$PageData = $db->runQuery("select * from " . STATE . " where state_id='" . $stateId . "'");
$CountryId = $PageData[0]['country_id'];
$StateName = $PageData[0]['state_name'];
}
$CounyryArr = array();
$CounyryArr[0]['key'] = "";
$CounyryArr[0]['value'] = "- - Country - -";
$CounyryData = $db->runQuery("select * from " . COUNTRIES . " order by country_name");
if ($CounyryData != "" and count($CounyryData) > 0) {
$i = 1;
foreach ($CounyryData as $key => $CounyryValues) {
$CounyryArr[$i]['key'] = $CounyryValues['country_id'];
$CounyryArr[$i]['value'] = $CounyryValues['country_name'];
$i++;
}
}
$country_id = new Zend_Form_Element_Select('country_id');
$country_id->setRequired(true)->addMultiOptions($CounyryArr)->addValidator('NotEmpty', true, array('messages' => 'Country is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "required")->setValue($CountryId);
$state_name = new Zend_Form_Element_Text('state_name');
$state_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'State Name is required.'))->addValidator('regex', true, array('pattern' => '/^[a-zA-Z\\-]+$/', 'messages' => array('regexNotMatch' => 'Please enter proper name and without space')))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($StateName);
$this->addElements(array($country_id, $state_name));
}
示例5: saveCurrency
public function saveCurrency($dataForm, $currencyId = "")
{
global $mySession;
$db = new Db();
$data_update['currency_name'] = trim($dataForm['currency_name']);
$data_update['currency_code'] = strtoupper(trim($dataForm['currency_code']));
$data_update['exchange_rate'] = $dataForm['exchange_rate'];
$maxquery = $db->runQuery("select max(currency_order) as MAX from " . CURRENCY . " ");
if ($currencyId == "") {
$currencyId = 0;
}
$chkQry2 = $db->runQuery("select * from " . CURRENCY . " where currency_code='" . mysql_escape_string(trim($data_update['currency_code'])) . "' and currency_id!=" . $currencyId);
if ($chkQry != "" and count($chkQry) > 0) {
return 0;
} else {
if ($currencyId > 0) {
$condition = 'currency_id=' . $currencyId;
$db->modify(CURRENCY, $data_update, $condition);
return 1;
} else {
$data_update['currency_order'] = $maxquery[0]['MAX'] + 1;
$db->save(CURRENCY, $data_update);
return 1;
}
}
}
示例6: saveAttribute
public function saveAttribute($dataForm, $attributeId = "")
{
global $mySession;
$db = new Db();
$dataForm = SetupMagicQuotesTrim($dataForm);
if ($attributeId == "") {
$chkQry = $db->runQuery("select * from " . ATTRIBUTE . " where attribute_name like '%" . mysql_escape_string(trim($dataForm['attribute_name'])) . "' ");
if ($chkQry != "" and count($chkQry) > 0) {
//if Same Question exists than return false / 0
// No Data Inserted
return 0;
} else {
$data = array();
$data['attribute_name'] = $dataForm['attribute_name'];
$data['attribute_status'] = $dataForm['attribute_status'];
$db->save(ATTRIBUTE, $data);
$latestId = $db->lastInsertId();
return 1;
}
} else {
$chkQry = $db->runQuery("select * from " . ATTRIBUTE . " where attribute_name like '%" . mysql_escape_string(trim($dataForm['attribute_name'])) . "' and attribute_id != '" . $attributeId . "' ");
if ($chkQry != "" and count($chkQry) > 0) {
//if Same Question exists than return false / 0
// No Data Inserted
return 0;
} else {
$data = array();
$data['attribute_name'] = $dataForm['attribute_name'];
$data['attribute_status'] = $dataForm['attribute_status'];
$condition = "attribute_id = " . $attributeId;
$db->modify(ATTRIBUTE, $data, $condition);
return 1;
}
}
}
示例7: init
public function init()
{
global $mySession;
$db = new Db();
$myControllerName = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
$myActionName = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
$this->view->myControllerName = $myControllerName;
$this->view->myActionName = $myActionName;
$defineData = $db->runQuery("select * from " . ADMINISTRATOR . " where admin_id='1'");
if (isset($mySession->LoggedUserId) and @$mySession->LoggedUserId != "") {
$userData = $db->runQuery("select * from " . USERS . " where user_id='" . $mySession->LoggedUserId . "'");
$this->view->userData = $userData;
}
if (!defined("ADMIN_EMAIL")) {
define("ADMIN_EMAIL", array_key_exists('admin_email', $defineData[0]) ? $defineData[0]['admin_email'] : '');
}
if (!defined("PAYPAL_TOKEN")) {
define("PAYPAL_TOKEN", array_key_exists('paypal_token', $defineData[0]) ? $defineData[0]['paypal_token'] : '');
}
if (!defined("PAYPAL_EMAIL")) {
define("PAYPAL_EMAIL", array_key_exists('paypal_email', $defineData[0]) ? $defineData[0]['paypal_email'] : '');
}
if (!defined("SITE_NAME")) {
define("SITE_NAME", array_key_exists('site_title', $defineData[0]) ? $defineData[0]['site_title'] : 'TeeshirtSCRIPT');
}
//define("PRICE_SYMBOL",$defineData[0]['currency_symbol']);
$Explode = explode("/", $_SERVER['REQUEST_URI']);
$SName = $Explode[count($Explode) - 1];
$ChkCampaign = $db->runQuery("select * from " . LAUNCHCAMPAIGN . " where trim(url)='" . urldecode($SName) . "' ");
if ($ChkCampaign != "" and count($ChkCampaign) > 0 && $myControllerName == "error" && $myActionName == "error") {
// Routing did not came up with a page, no problem as the URL is related to a campaign URL
$myform1 = new Form_Buy();
//$this->view->myform1=$myform1;
$sizes = $db->runQuery("select * from " . TSHIRT_SIZE);
$this->view->sizes = $sizes;
$this->view->CampaignData = $ChkCampaign;
include "application/layouts/scripts/campaign.phtml";
// Load Campaign view!
exit;
}
if (isset($mySession->TeeLoggedID) and @$mySession->TeeLoggedID != "") {
if ($myControllerName == "signup" || $myControllerName == "login" || $myControllerName == "forgotpassword") {
$this->_redirect(APPLICATION_URL . 'myaccount/profile');
}
} else {
if ($myControllerName == "myaccount" || $myControllerName == "launchcampaign" && $myActionName == "edit") {
$this->_redirect(APPLICATION_URL . 'index/index');
}
}
if ($myControllerName == "launchcampaign") {
if (stripslashes(array_key_exists('recreation_product', $_POST) ? $_POST['recreation_product'] : '') != '') {
$mySession->recreation_product = stripslashes($_POST['recreation_product']);
}
if (stripslashes(array_key_exists('priceValueKM', $_POST) ? $_REQUEST['priceValueKM'] != '' : '') && stripslashes(array_key_exists('idValueKM', $_POST) ? $_REQUEST['idValueKM'] != '' : '')) {
$mySession->priceValueKM = $_REQUEST['priceValueKM'];
$mySession->selectedIdValueKM = $_REQUEST['idValueKM'];
}
}
$this->_helper->layout->setLayout('main');
}
示例8: init
public function init($review_id)
{
global $mySession;
$db = new Db();
$airport1_value = "";
$review_date_value = "";
$property_value = "";
$status_value = "";
$review_value = "";
$description_value = "";
$amenityArr = $db->runQuery("select * from " . OWNER_REVIEW . " where review_status = '1' ");
if ($review_id != "") {
$pptyData = $db->runQuery("select guest_name, property_title, review_date, location, review_status, check_in, review, \n\t\t\t\t\t\t\t\t\t " . OWNER_REVIEW . ".rating as rating, headline, comment from " . OWNER_REVIEW . " \n\t\t\t\t\t\t\t\t\t inner join " . PROPERTY . " on " . PROPERTY . ".id = " . OWNER_REVIEW . ".property_id \n\t\t\t\t\t\t\t\t\t where review_id = '" . $review_id . "' ");
$user_value = $pptyData[0]['guest_name'];
$property_value = $pptyData[0]['property_title'];
$review_date_value = date('d-m-Y', strtotime($pptyData[0]['review_date']));
$location_value = $pptyData[0]['location'];
$status_value = $pptyData[0]['review_status'];
$check_in_value = date('d-m-Y', strtotime($pptyData[0]['check_in']));
$rating_value = $pptyData[0]['rating'];
$review_value = $pptyData[0]['review'];
$headline_value = $pptyData[0]['headline'];
$comment_value = $pptyData[0]['comment'];
}
$i = 0;
$full_name = new Zend_Form_Element_Text('full_name');
$full_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => "Please enter Full Name"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setAttrib("maxlength", "50")->setValue($user_value);
$location = new Zend_Form_Element_Text('location');
$location->setRequired(true)->addValidator('NotEmpty', true, array('messages' => "enter email address"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setAttrib("maxlength", "50")->setValue($location_value);
$check_in = new Zend_Form_Element_Text('check_in');
$check_in->setRequired(true)->addValidator('NotEmpty', true, array('messages' => "Please enter phone number"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput mws-datepicker required ")->setValue($check_in_value);
$ratingArr = array();
$ratingArr[0]['key'] = "";
$ratingArr[0]['value'] = "- - Select - -";
for ($i = 1; $i <= 10; $i++) {
$ratingArr[$i]['key'] = $i;
$ratingArr[$i]['value'] = $i;
}
$rating = new Zend_Form_Element_Select('rating');
$rating->setRequired(true)->addMultiOptions($ratingArr)->addValidator('NotEmpty', true, array('messages' => "Enter Rating"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($rating_value);
$headline = new Zend_Form_Element_Text('headline');
$headline->setRequired(true)->addValidator('NotEmpty', true, array('messages' => "Enter Review Headline"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required reviewHeadline")->setAttrib("maxlength", "100")->setValue($headline_value);
$comment = new Zend_Form_Element_Textarea('comment');
$comment->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "required")->setAttrib("rows", "4")->setAttrib("cols", "30")->setAttrib("maxlength", "300")->setValue($comment_value);
$review = new Zend_Form_Element_Textarea('review');
$review->setRequired(true)->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "required")->setAttrib("rows", "4")->setAttrib("cols", "30")->setAttrib("maxlength", "1000")->addValidator('NotEmpty', true, array('messages' => "Enter Review"))->setValue($review_value);
$statusArr[0]['key'] = "";
$statusArr[0]['value'] = "- - Select - ";
$statusArr[1]['key'] = "0";
$statusArr[1]['value'] = "Disable";
$statusArr[2]['key'] = "1";
$statusArr[2]['value'] = "Enable";
$status = new Zend_Form_Element_Select('status');
$status->setRequired(true)->addMultiOptions($statusArr)->setValue($status_value);
$this->addElements(array($full_name, $location, $check_in, $rating, $headline, $comment, $review, $status));
}
示例9: init
public function init($cityId)
{
global $mySession;
$db = new Db();
$CountryId = "";
$StateId = "";
$CityName = "";
if ($cityId != "") {
$PageData = $db->runQuery("select * from " . CITIES . " where city_id='" . $cityId . "'");
$CountryId = $PageData[0]['country_id'];
$StateId = $PageData[0]['state_id'];
$CityName = $PageData[0]['city_name'];
}
$CountryArr = array();
$CountryArr[0]['key'] = "";
$CountryArr[0]['value'] = "- - Country - -";
$CountryData = $db->runQuery("select * from " . COUNTRIES . " order by country_name");
if ($CountryData != "" and count($CountryData) > 0) {
$i = 1;
foreach ($CountryData as $key => $CountryValues) {
$CountryArr[$i]['key'] = $CountryValues['country_id'];
$CountryArr[$i]['value'] = $CountryValues['country_name'];
$i++;
}
}
$country_id = new Zend_Form_Element_Select('country_id');
$country_id->setRequired(true)->addMultiOptions($CountryArr)->addValidator('NotEmpty', true, array('messages' => 'Country is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("style", "width:250px;")->setAttrib("onchange", "getCountryState(this.value);")->setValue($CountryId);
$StateArr = array();
$StateArr[0]['key'] = "";
$StateArr[0]['value'] = "- - State - -";
$chkCountryId = $CountryId;
if (isset($_REQUEST['country_id']) && $_REQUEST['country_id'] != "") {
$chkCountryId = $_REQUEST['country_id'];
}
if ($chkCountryId != "") {
$StateData = $db->runQuery("select * from " . STATE . " where country_id='" . $chkCountryId . "' order by state_name");
if ($StateData != "" and count($StateData) > 0) {
$i = 1;
foreach ($StateData as $key => $StateValues) {
$StateArr[$i]['key'] = $StateValues['state_id'];
$StateArr[$i]['value'] = $StateValues['state_name'];
$i++;
}
}
}
$state_id = new Zend_Form_Element_Select('state_id');
$state_id->setRequired(true)->addMultiOptions($StateArr)->addValidator('NotEmpty', true, array('messages' => 'State is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("style", "width:250px;")->setValue($StateId);
$city_name = new Zend_Form_Element_Text('city_name');
$city_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'City Name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setAttrib("style", "width:250px;")->setValue($CityName);
$this->addElements(array($country_id, $state_id, $city_name));
}
示例10: saveReview
public function saveReview($dataForm)
{
global $mySession;
$db = new Db();
$data_update = array();
$chckArr = $db->runQuery("select * from " . PROPERTY . " where propertycode = '" . trim($dataForm['ppty_no']) . "' and status = '3'");
if (count($chckArr) > 0 && $chckArr != "") {
$data_update['guest_name'] = $dataForm['full_name'];
$data_update['location'] = $dataForm['location'];
$check_in = explode("/", $dataForm['check_in']);
$data_update['check_in'] = date('Y-m-d', strtotime($check_in[2] . "-" . $check_in[1] . "-" . $check_in[0]));
$data_update['rating'] = $dataForm['rating'];
$data_update['user_id'] = $mySession->LoggedUserId;
$data_update['headline'] = $dataForm['headline'];
$data_update['comment'] = $dataForm['comment'];
$data_update['review'] = $dataForm['review'];
$data_update['uType'] = $mySession->LoggedUserType == '1' ? "1" : "0";
$data_update['review_date'] = date("Y-m-d");
$data_update["property_id"] = $chckArr[0]['id'];
$data_update['guest_image'] = $mySession->LoggedUser['image'];
copy(SITE_ROOT . "images/" . $mySession->LoggedUser['image'], SITE_ROOT . "images/profile/" . $mySession->LoggedUser['image']);
$db->save(OWNER_REVIEW, $data_update);
$review_id = $db->lastInsertId();
//====== code to enter new latest review properties ===============
//two cases are there
//1. if already an entry is there within latest reviews
//2. first entry is made for specific property
$reviewPptyArr = $db->runQuery("select * from " . LATEST_REVIEW . " where r_property_id = '" . $chckArr[0]['id'] . "' ");
//case 1
if (count($reviewPptyArr) > 0 && $reviewPptyArr != "") {
$db->delete(LATEST_REVIEW, "r_id = " . $reviewPptyArr[0]['r_id']);
$updateData = array();
$updateData['r_order'] = new Zend_Db_Expr('r_order-1');
$db->modify(LATEST_REVIEW, $updateData, "r_order > " . $reviewPptyArr[0]['r_order']);
} else {
$updateData = array();
$updateData['r_order'] = new Zend_Db_Expr('r_order+1');
$db->modify(LATEST_REVIEW, $updateData);
$saveData = array();
$saveData['r_property_id'] = $chckArr[0]['id'];
$saveData['r_order'] = '1';
//$saveData['r_review_id'] = $review_id;
$saveData['r_status'] = '1';
$db->save(LATEST_REVIEW, $saveData);
}
//-----------------------------------------------------------------
return 1;
} else {
return 0;
}
}
示例11: pagesAction
public function pagesAction()
{
global $mySession;
$db = new Db();
$slug = $this->getRequest()->getParam("slug");
$userArr = $db->runQuery("select * from " . USERS . " where user_id = '" . $mySession->LoggedUserId . "' ");
$sql = "select * from " . PAGES1 . " where synonyms = '{$slug}'";
$staticArr = $db->runQuery($sql);
$strContent = str_replace("[SITEURL]", APPLICATION_URL, $staticArr[0]['page_content']);
$strContent = str_replace("[FULLNAME]", $userArr[0]['email_address'], $strContent);
if (!isLogged()) {
$strContent = str_replace("[LOGINMSG]", "<a href='" . APPLICATION_URL . "/signin'>click here</a> to Login", $strContent);
} else {
$strContent = str_replace("[LOGINMSG]", "", $strContent);
}
$this->view->pageContent = $strContent;
$this->view->pageTitle = $staticArr[0]['page_title'];
$this->view->page_id = $staticArr[0]['page_id'];
if ($staticArr[0]['page_id'] == '12' || $staticArr[0]['page_id'] == '63') {
$myform = new Form_Contact();
$this->view->myform = $myform;
}
if ($staticArr[0]['page_id'] == '80') {
$myform = new Form_Ocontact();
$this->view->myform = $myform;
}
$varsuccess = 0;
if ($this->getRequest()->isPost()) {
$request = $this->getRequest();
$dataForm = $myform->getValues();
if ($myform->isValid($request->getPost())) {
$dataForm = $myform->getValues();
//prd($dataForm);
if ($dataForm['captcha'] == $_SESSION['captcha']) {
$myObj = new Users();
if ($staticArr[0]['page_id'] == '80') {
$Result = $myObj->ownercontactus($dataForm);
} else {
$Result = $myObj->contactus($dataForm);
}
$mySession->sucessMsg = "Thank you, You will soon be contacted";
$varsuccess = 1;
} else {
$mySession->errorMsg = "Human Verification code is wrong";
}
}
}
$this->view->myform = $myform;
$this->view->varsuccess = $varsuccess;
}
示例12: init
public function init($userType, $userId)
{
global $mySession;
$db = new Db();
$receiver_id_value = "";
$message_subject_value = "";
$message_text_value = "";
if ($userType == '1') {
$ReceiverArr = array();
$ReceiverArr[0]['key'] = "0";
$ReceiverArr[0]['value'] = "ADMIN";
} else {
$ReceiverArr = array();
if ($userId != "") {
$ReceiverData = $db->runQuery("select " . USERS . ".user_id,concat(first_name,' ',last_name) as ReceiverName,\n\t\t\t\t\t\t\t\t\t\t email_address, uType from " . USERS . " where " . USERS . ".user_id != '" . $userId . "' \n\t\t\t\t\t\t\t\t\t\t and " . USERS . ".user_status = '1'\n\t\t\t\t\t\t\t\t\t\t ");
} else {
$ReceiverData = $db->runQuery("select " . USERS . ".user_id,concat(first_name,' ',last_name) as ReceiverName,\n\t\t\t\t\t\t\t\t\t\t email_address, uType from " . USERS . " where " . USERS . ".user_status = '1' ");
}
}
if ($ReceiverData != "" and count($ReceiverData) > 0) {
$i = 1;
foreach ($ReceiverData as $key => $ReceiverValues) {
$usertype = $ReceiverValues['uType'] == '2' ? "Owner" : "Customer";
$ReceiverArr[$i]['key'] = $ReceiverValues['user_id'];
$ReceiverArr[$i]['value'] = $ReceiverValues['email_address'] . " [" . $usertype . "]";
$i++;
}
}
$box1View = new Zend_Form_Element_Select('box1View');
$box1View->addMultiOptions($ReceiverArr)->setAttrib("multiple", "multiple")->setRegisterInArrayValidator(false)->setAttrib("style", "width:100%;height:250px;")->setValue($receiver_id_value);
$this->addElement($box1View);
$box2View = new Zend_Form_Element_Select('box2View');
$box2View->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Reciever is required'))->setRegisterInArrayValidator(false)->setAttrib("multiple", "multiple")->setAttrib("style", "width:100%;height:250px;");
$this->addElement($box2View);
if ($userId != "") {
$ReceiverData = $db->runQuery("select " . USERS . ".user_id,concat(first_name,' ',last_name) as ReceiverName,\n\t\t\t\t\t\t\t\t\t\t\t email_address, uType from " . USERS . " where " . USERS . ".user_id = '" . $userId . "' ");
$ReceiverArr = array();
$usertype = $ReceiverValues['uType'] == '2' ? "Owner" : "Customer";
$ReceiverArr[0]['key'] = $ReceiverData[0]['user_id'];
$ReceiverArr[0]['value'] = $ReceiverData[0]['email_address'] . " [" . $usertype . "]";
$box2View->addMultiOptions($ReceiverArr);
}
$message_subject = new Zend_Form_Element_Text('message_subject');
$message_subject->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Message subject is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($message_subject_value);
$this->addElement($message_subject);
$message_text = new Zend_Form_Element_Textarea('message_text');
$message_text->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Message is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($message_text_value);
$this->addElement($message_text);
}
示例13: myInit
public function myInit($Id)
{
global $mySession;
$db = new Db();
if ($Id != "") {
$adminData = $db->runQuery("select * from " . TSHIRT_ICONS . " where id='" . $Id . "'");
$title_value = $adminData[0]['title'];
$oldicon_value = $adminData[0]['icon'];
$colorcode_value = $adminData[0]['colorcode'];
} else {
$title_value = '';
$oldicon_value = '';
$colorcode_value = '';
}
$title = new Zend_Form_Element_Text('title');
$title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'First Name is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($title_value);
$colorcode = new Zend_Form_Element_Text('colorcode');
$colorcode->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Please enter color code.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "Expandable mws-textinput required")->setAttrib("onkeypress", "return checknummspK(event)")->setValue($colorcode_value);
$this->addElement($colorcode);
$this->addElement($title);
if ($Id == "") {
$image = new Zend_Form_Element_File('image');
$image->setDestination(SITE_ROOT . 'images/tshirt-icons/')->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Please select an icon.'))->addValidator('Extension', false, 'jpg,jpeg,png,gif')->setAttrib("class", "textbox")->addDecorator('Errors', array('class' => 'error'));
} else {
$image = new Zend_Form_Element_File('image');
$image->setDestination(SITE_ROOT . 'images/tshirt-icons/')->addValidator('Extension', false, 'jpg,jpeg,png,gif')->setAttrib("class", "textbox");
}
$this->addElement($image);
if ($Id != "") {
$oldicon = new Zend_Form_Element_Hidden('oldicon');
$oldicon->setValue($oldicon_value);
$this->addElement($oldicon);
$this->addElement("hidden", "foo", array("decorators" => array(array(array("img" => "HtmlTag"), array("tag" => "img", "openOnly" => true, "src" => IMAGES_URL . 'tshirt-icons/' . $oldicon_value, "align" => "middle", "class" => "myClass", "style" => "max-width:200px;max-height:200px;")), array("ViewHelper"), array(array("span" => "HtmlTag"), array("tag" => "span", "class" => "myElement", "style" => "text-align:center;display:block;")))));
}
}
示例14: init
public function init($blogId)
{
// echo "hello ".$blogId; exit();
global $mySession;
$db = new Db();
$title_value = "";
$description_value = "";
$status_value = "1";
if ($blogId != "") {
$blogData = $db->runQuery("select * from " . BLOG_POST . " where blog_post_id='" . $blogId . "'");
$title_value = $blogData[0]['title'];
$description_value = $blogData[0]['description'];
$status_value = $blogData[0]['status'];
}
$StatusArr = array();
$StatusArr[0]['key'] = "1";
$StatusArr[0]['value'] = "Enable";
$status = new Zend_Form_Element_Select('status');
$status->addMultiOptions($StatusArr)->setAttrib("class", "textInput")->setValue($status_value);
$title = new Zend_Form_Element_Text('title');
$title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'blog title is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setValue($title_value);
$description = new Zend_Form_Element_Textarea('description');
$description->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'blog description is required.'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "textInput")->setAttrib("rows", "3")->setAttrib("style", "height:100px;")->setValue($description_value);
$this->addElements(array($status, $title, $description));
}
示例15: UpdateSub
public function UpdateSub($dataForm, $userId)
{
global $mySession;
$db = new Db();
$dataForm = SetupMagicQuotes($dataForm);
$chkQry = $db->runQuery("select * from " . SUBSCRIPTION . " where mobile_number='" . $dataForm['mobile_number'] . "' and user_id!='" . $userId . "'");
if ($chkQry != "" and count($chkQry) > 0) {
return 0;
} else {
$dataUpdate['first_name'] = $dataForm['first_name'];
$dataUpdate['last_name'] = $dataForm['last_name'];
$dataUpdate['email_address'] = $dataForm['email_address'];
$dataUpdate['username'] = $dataForm['username'];
$dataUpdate['address'] = $dataForm['address'];
$dataUpdate['country_id'] = $dataForm['country_id'];
$dataUpdate['state_id'] = $dataForm['state_id'];
$dataUpdate['city_id'] = $dataForm['city_id'];
$dataUpdate['zipcode'] = $dataForm['zipcode'];
$dataUpdate['phone_number'] = $dataForm['phone_number'];
$dataUpdate['mobile_number'] = $dataForm['mobile_number'];
$dataUpdate['newsletter_subscribe'] = $dataForm['subscribe'];
$conditionUpdate = "user_id='" . $userId . "'";
$db->modify(USERS, $dataUpdate, $conditionUpdate);
return $userId;
}
}