当前位置: 首页>>代码示例>>PHP>>正文


PHP SQL::insert方法代码示例

本文整理汇总了PHP中SQL::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP SQL::insert方法的具体用法?PHP SQL::insert怎么用?PHP SQL::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SQL的用法示例。


在下文中一共展示了SQL::insert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: POST

 public static function POST($req)
 {
     $table = Common::route($req);
     $sql['table'] = $table;
     $data = Common::data($req->data, $table);
     if (isset($data['unknown'])) {
         print 'unknown columns: ' . implode(',', $data['unknown']);
     } else {
         if (isset($data['columns']) && isset($data['values'])) {
             $sql['columns'] = '(' . implode(',', $data['columns']) . ')';
             $sql['values'] = '(' . implode(',', $data['values']) . ')';
             SQL::insert($sql);
         } else {
             print 'invalid data';
         }
     }
 }
开发者ID:skiv71,项目名称:BMSLink-API,代码行数:17,代码来源:methods.php

示例2: save

 function save()
 {
     global $objDatabase, $_ARRAYLANG;
     $arrFields = array('title' => $this->title, 'UserRestriction' => $this->surveyType, 'description' => $this->description, 'textAfterButton' => $this->textBeginSurvey, 'text1' => $this->textBeforeSubscriberInfo, 'text2' => $this->textBelowSubmit, 'thanksMSG' => $this->textFeedbackMsg, 'isHomeBox' => (int) $this->isStandred(), 'additional_salutation' => $this->salutation, 'additional_nickname' => $this->nickname, 'additional_forename' => $this->forename, 'additional_surname' => $this->surname, 'additional_agegroup' => $this->agegroup, 'additional_email' => $this->email, 'additional_phone' => $this->phone, 'additional_street' => $this->street, 'additional_zip' => $this->zip, 'additional_city' => $this->city);
     if (empty($this->id)) {
         $query = \SQL::insert('module_survey_surveygroup', $arrFields, array('escape' => true));
     } else {
         $arrFields['updated'] = date("Y-m-d H:i:s");
         $query = \SQL::update('module_survey_surveygroup', $arrFields, array('escape' => true)) . " WHERE `id` = {$this->id}";
     }
     // echo $query;
     if ($objDatabase->Execute($query)) {
         $this->okMsg[] = empty($this->id) ? $_ARRAYLANG['TXT_SURVEY_ADDED_SUC_TXT'] : $_ARRAYLANG['TXT_SURVEY_UPDATE_SUC_TXT'];
         return true;
     } else {
         $this->errorMsg[] = $_ARRAYLANG['TXT_SURVEY_ERROR_IN_SAVING'];
         return true;
     }
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:19,代码来源:SurveyEntry.class.php

示例3: build

 /**
  * Builds the different types of SQL queries
  * This uses the SQL class to build stuff.
  *
  * @param string $type (select, update, insert)
  * @return string The final query
  */
 public function build($type)
 {
     $sql = new SQL($this->db);
     switch ($type) {
         case 'select':
             return $sql->select(array('table' => $this->table, 'columns' => $this->select, 'join' => $this->join, 'distinct' => $this->distinct, 'where' => $this->where, 'group' => $this->group, 'having' => $this->having, 'order' => $this->order, 'offset' => $this->offset, 'limit' => $this->limit));
         case 'update':
             return $sql->update(array('table' => $this->table, 'where' => $this->where, 'values' => $this->values));
         case 'insert':
             return $sql->insert(array('table' => $this->table, 'values' => $this->values));
         case 'delete':
             return $sql->delete(array('table' => $this->table, 'where' => $this->where));
     }
 }
开发者ID:irenehilber,项目名称:kirby-base,代码行数:21,代码来源:query.php

示例4: showCompanySize

 /**
  * show all company size
  * 
  * @global array  $_ARRAYLANG
  * @global object $objDatabase
  * 
  * @return null
  */
 function showCompanySize()
 {
     global $_ARRAYLANG, $objDatabase;
     \JS::activate("jquery");
     $subTpl = isset($_GET['subTpl']) ? $_GET['subTpl'] : '';
     $this->settingsController = new CrmSettings($this->_objTpl, $this->moduleName);
     $fields = array('company_size' => isset($_POST['companySize']) ? contrexx_input2raw($_POST['companySize']) : '', 'sorting' => isset($_POST['sorting']) ? contrexx_input2raw($_POST['sorting']) : '', 'status' => isset($_POST['status']) ? 1 : (empty($_POST) ? 1 : 0));
     if (!empty($subTpl)) {
         switch ($subTpl) {
             case 'modifyCompanySize':
                 $this->modifyCompanySize($fields);
                 break;
         }
         return;
     }
     //get the post values
     $action = isset($_REQUEST['actionType']) ? $_REQUEST['actionType'] : '';
     $entries = isset($_REQUEST['companySizeEntry']) ? array_map('intval', $_REQUEST['companySizeEntry']) : 0;
     $sorting = isset($_REQUEST['sorting']) ? array_map('intval', $_REQUEST['sorting']) : 0;
     $id = isset($_GET['id']) ? contrexx_input2raw($_GET['id']) : 0;
     switch ($action) {
         case 'changestatus':
             $this->activateCompanySize($id);
         case 'activate':
             $this->activateCompanySize($entries);
             break;
         case 'deactivate':
             $this->activateCompanySize($entries, true);
             break;
         case 'delete':
             $companySizeIds = isset($_GET['ajax']) ? $id : $entries;
             $this->deleteCompanySize($companySizeIds);
             break;
         default:
             break;
     }
     if (isset($_GET['ajax'])) {
         exit;
     }
     if (!empty($action) || isset($_POST['save_entries'])) {
         $this->saveSortingCompanySize($sorting);
     }
     $objTpl = $this->_objTpl;
     $objTpl->addBlockfile('CRM_SETTINGS_FILE', 'settings_block', 'module_crm_settings_company_size.html');
     $this->_pageTitle = $_ARRAYLANG['TXT_CRM_SETTINGS'];
     if ($_POST['save']) {
         //insert
         $query = \SQL::insert('module_' . $this->moduleNameLC . '_company_size', $fields, array('escape' => true));
         $db = $objDatabase->Execute($query);
         if ($db) {
             $_SESSION['strOkMessage'] = $_ARRAYLANG['TXT_CRM_ENTRY_ADDED_SUCCESS'];
         } else {
             $_SESSION['strErrMessage'] = $_ARRAYLANG['TXT_CRM_ENTRY_ADDED_ERROR'];
         }
     }
     $this->getCompanySize();
     $this->parseCompanySizePlaceholders();
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:66,代码来源:CrmSettings.class.php

示例5: insert

 /**
  * Insert news
  * @global     object    $objDatabase
  * @return    boolean   result
  */
 function insert()
 {
     global $objDatabase, $_ARRAYLANG;
     $objFWUser = \FWUser::getFWUserObject();
     // Unused
     //        $noerror = true;
     $errorlist = "";
     $date = $this->_checkDate($_POST['creation_date']);
     $title = get_magic_quotes_gpc() ? strip_tags($_POST['jobsTitle']) : addslashes(strip_tags($_POST['jobsTitle']));
     $author = get_magic_quotes_gpc() ? strip_tags($_POST['author']) : addslashes(strip_tags($_POST['author']));
     $text = get_magic_quotes_gpc() ? $_POST['jobsText'] : addslashes($_POST['jobsText']);
     $title = str_replace("ß", "ss", $title);
     $text = str_replace("ß", "ss", $text);
     $text = $this->filterBodyTag($text);
     $workloc = get_magic_quotes_gpc() ? strip_tags($_POST['workloc']) : addslashes(strip_tags($_POST['workloc']));
     $workload = get_magic_quotes_gpc() ? strip_tags($_POST['workload']) : addslashes(strip_tags($_POST['workload']));
     if (empty($_POST['work_start'])) {
         $work_start = "0000-00-00";
     } else {
         $work_start = $_POST['work_start'];
     }
     //start 'n' end
     $dateparts = explode("-", $work_start);
     $work_start = mktime(00, 00, 00, $dateparts[1], $dateparts[2], $dateparts[0]);
     $cat = intval($_POST['jobsCat']);
     $userid = $objFWUser->objUser->getId();
     $startDate = get_magic_quotes_gpc() ? strip_tags($_POST['startDate']) : addslashes(strip_tags($_POST['startDate']));
     $endDate = get_magic_quotes_gpc() ? strip_tags($_POST['endDate']) : addslashes(strip_tags($_POST['endDate']));
     $status = intval($_POST['status']);
     if (empty($title) or empty($cat)) {
         $this->strErrMessage = $_ARRAYLANG['TXT_JOBS_ERROR'];
         $this->edit();
     }
     if ($status == 0) {
         $startDate = "";
         $endDate = "";
     }
     $query = \SQL::insert('module_jobs', array('date' => array('val' => $date, 'omitEmpty' => true), 'title' => $title, 'author' => $author, 'text' => array('val' => $text, 'omitEmpty' => true), 'workloc' => $workloc, 'workload' => $workload, 'work_start' => array('val' => $work_start, 'omitEmpty' => true), 'catid' => array('val' => $cat, 'omitEmpty' => true), 'lang' => array('val' => $this->langId, 'omitEmpty' => true), 'startdate' => array('val' => $startDate, 'omitEmpty' => true), 'enddate' => array('val' => $endDate, 'omitEmpty' => true), 'status' => array('val' => $status, 'omitEmpty' => true), 'userid' => array('val' => $userid, 'omitEmpty' => true), 'changelog' => array('val' => $date, 'omitEmpty' => true)));
     if ($objDatabase->Execute($query)) {
         $id = $objDatabase->Insert_id();
         $rel_loc_jobs = "";
         if (!isset($id)) {
             $this->strErrMessage = $_ARRAYLANG['TXT_JOBS_LOCATIONS_NOT_ASSIGNED'];
             $this->overview();
             return;
         }
         if (isset($_POST['associated_locations'])) {
             foreach ($_POST['associated_locations'] as $value) {
                 $rel_loc_jobs .= " ({$id},{$value}),";
             }
             $rel_loc_jobs = substr_replace($rel_loc_jobs, "", -1);
         } else {
             $this->strOkMessage = $_ARRAYLANG['TXT_DATA_RECORD_ADDED_SUCCESSFUL'];
             $this->overview();
             return;
         }
         $query = "INSERT INTO `" . DBPREFIX . "module_jobs_rel_loc_jobs` (job,location) VALUES {$rel_loc_jobs} ";
         if ($objDatabase->Execute($query)) {
             $this->strOkMessage = $_ARRAYLANG['TXT_DATA_RECORD_ADDED_SUCCESSFUL'];
         } else {
             $this->strErrMessage = $_ARRAYLANG['TXT_JOBS_LOCATIONS_NOT_ASSIGNED'];
         }
     } else {
         $this->strErrMessage = $_ARRAYLANG['TXT_DATABASE_QUERY_ERROR'];
     }
     if (!empty($errorlist)) {
         $this->strErrMessage .= "<br />" . $errorlist;
     }
     if (!empty($this->strErrMessage)) {
         $this->edit($id);
     } else {
         $this->overview();
     }
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:79,代码来源:JobsManager.class.php

示例6: insert

 public function insert($data = array(), $fields = false)
 {
     $this->adjustDataAndFields($data, $fields);
     return parent::insert($data, $fields);
 }
开发者ID:evgeny-v-z,项目名称:framework,代码行数:5,代码来源:TableDataGateway.php

示例7: PSPaymaster

}
$rs = $ST->select("SELECT * FROM sc_pay_system WHERE name='paymaster'");
if ($rs->next() && $_GET) {
    $ps = new PSPaymaster(unserialize($rs->get('config')));
    if ($ps->checkSignature($_POST)) {
        //Данные прошли проверку
        $rs = $ST->select("SELECT * FROM sc_income \r\n\t\t\t\tWHERE \r\n\t\t\t\t\tpay_id=" . intval($_POST['LMI_PAYMENT_NO']) . "\r\n\t\t\t\t\tAND type='paymaster'");
        if ($rs->next()) {
            //перевод уже был, всё ок
            echo 'OK' . $_POST['LMI_PAYMENT_NO'];
            exit;
        } else {
            //если указан номер заявки
            if (isset($_POST['LMI_PAYMENT_NO'])) {
                $rs = $ST->select("SELECT * FROM sc_shop_order WHERE id=" . intval($_POST['LMI_PAYMENT_NO']));
                if ($rs->next()) {
                    if (floatval($_POST['LMI_PAYMENT_AMOUNT']) == $rs->getFloat('total_price')) {
                        $ST->update('sc_shop_order', array('pay_time' => date('Y-m-d H:i:s'), 'pay_status' => '1'), 'id=' . intval($_POST['LMI_PAYMENT_NO']));
                        //Оплата заказа
                        $ST->insert('sc_income', array('userid' => $rs->getInt('userid'), 'sum' => floatval($_POST['LMI_PAYMENT_AMOUNT']), 'type' => 'paymaster', 'description' => "Оплата заказа {$_POST['LMI_PAYMENT_NO']}", 'pay_id' => intval($_POST['LMI_PAYMENT_NO']), 'pay_string' => http_build_query($_POST)));
                        /*Уведомление*/
                        $mail = new Mail();
                        $mail->sendTemplateMail($CONFIG['MAIL'], 'notice_admin_user_buy', $rs->getRow());
                        //							$mail->sendTemplateMail($user['mail'],'notice_user_buy',$rs->getRow());
                    }
                }
            }
            echo 'OK' . $_POST['LMI_PAYMENT_NO'];
        }
    }
}
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:31,代码来源:result.php

示例8: setUser

 public function setUser($id)
 {
     $this->user = new User($id);
     $statement = new Database(SQL::update('user', 'sessions', 'id=:id'), array(':id' => $this->id, ':user' => $this->user->id));
     if ($id) {
         $statement = new Database(SQL::insert('time,user', 'user_logins', 'id=:id'), array(':time' => time(), ':user' => $id));
     }
 }
开发者ID:Oudmane,项目名称:OudyPlat,代码行数:8,代码来源:Session.php

示例9: save


//.........这里部分代码省略.........
                         $seriesPatternDay = isset($data['seriesMonthlyDay']) ? intval($data['seriesMonthlyDay']) : 0;
                         $seriesPatternWeekday = 0;
                     } else {
                         $seriesPatternCount = isset($data['seriesMonthlyDayCount']) ? intval($data['seriesMonthlyDayCount']) : 0;
                         $seriesPatternMonth = isset($data['seriesMonthlyMonth_2']) ? intval($data['seriesMonthlyMonth_2']) : 0;
                         if ($seriesPatternMonth < 1) {
                             // the increment must be at least once a month, otherwise we will end up in a endless loop in the presence
                             $seriesPatternMonth = 1;
                         }
                         $seriesPatternWeekday = isset($data['seriesMonthlyWeekday']) ? $data['seriesMonthlyWeekday'] : '';
                         $seriesPatternDay = 0;
                     }
                     $seriesPatternWeek = 0;
                 }
                 break;
         }
         $seriesPatternDouranceType = isset($data['seriesDouranceType']) ? intval($data['seriesDouranceType']) : 0;
         switch ($seriesPatternDouranceType) {
             case 1:
                 $seriesPatternEnd = 0;
                 break;
             case 2:
                 $seriesPatternEnd = isset($data['seriesDouranceEvents']) ? intval($data['seriesDouranceEvents']) : 0;
                 break;
             case 3:
                 $seriesPatternEndDate = date("Y-m-d H:i:s", parent::getDateTimestamp($data['seriesDouranceDate'], 23, 59));
                 break;
         }
     }
     $formData = array('type' => $type, 'startdate' => $startDate, 'enddate' => $endDate, 'use_custom_date_display' => $useCustomDateDisplay, 'showStartDateList' => $showStartDateList, 'showEndDateList' => $showEndDateList, 'showStartTimeList' => $showStartTimeList, 'showEndTimeList' => $showEndTimeList, 'showTimeTypeList' => $showTimeTypeList, 'showStartDateDetail' => $showStartDateDetail, 'showEndDateDetail' => $showEndDateDetail, 'showStartTimeDetail' => $showStartTimeDetail, 'showEndTimeDetail' => $showEndTimeDetail, 'showTimeTypeDetail' => $showTimeTypeDetail, 'google' => $google, 'access' => $access, 'priority' => $priority, 'price' => $price, 'link' => $link, 'pic' => $pic, 'catid' => $catId, 'attach' => $attach, 'place_mediadir_id' => $placeMediadir, 'host_mediadir_id' => $hostMediadir, 'show_in' => $showIn, 'invited_groups' => $invited_groups, 'invited_mails' => $invited_mails, 'invitation_email_template' => json_encode($invitationTemplate), 'registration' => $registration, 'registration_form' => $registration_form, 'registration_num' => $registration_num, 'registration_notification' => $registration_notification, 'email_template' => json_encode($email_template), 'ticket_sales' => $ticket_sales, 'num_seating' => $num_seating, 'series_status' => $seriesStatus, 'series_type' => $seriesType, 'series_pattern_count' => $seriesPatternCount, 'series_pattern_weekday' => $seriesPatternWeekday, 'series_pattern_day' => $seriesPatternDay, 'series_pattern_week' => $seriesPatternWeek, 'series_pattern_month' => $seriesPatternMonth, 'series_pattern_type' => $seriesPatternType, 'series_pattern_dourance_type' => $seriesPatternDouranceType, 'series_pattern_end' => $seriesPatternEnd, 'series_pattern_end_date' => $seriesPatternEndDate, 'series_pattern_exceptions' => $seriesExeptions, 'all_day' => $allDay, 'location_type' => $locationType, 'host_type' => $hostType, 'place' => $place, 'place_id' => 0, 'place_street' => $street, 'place_zip' => $zip, 'place_city' => $city, 'place_country' => $country, 'place_link' => $placeLink, 'place_map' => $placeMap, 'org_name' => $orgName, 'org_street' => $orgStreet, 'org_zip' => $orgZip, 'org_city' => $orgCity, 'org_country' => $orgCountry, 'org_link' => $orgLink, 'org_email' => $orgEmail, 'invitation_sent' => $update_invitation_sent ? 1 : 0);
     if ($id != 0) {
         $query = \SQL::update("module_{$this->moduleTablePrefix}_event", $formData) . " WHERE id = '{$id}'";
         $objResult = $objDatabase->Execute($query);
         if ($objResult !== false) {
             $this->id = $id;
             $query = "DELETE FROM " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_event_field\n                                WHERE event_id = '" . $id . "'";
             $objResult = $objDatabase->Execute($query);
             $query = "DELETE FROM " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_rel_event_host\n                                WHERE event_id = '" . $id . "'";
             $objResult = $objDatabase->Execute($query);
         } else {
             return false;
         }
     } else {
         $objFWUser = \FWUser::getFWUserObject();
         $objUser = $objFWUser->objUser;
         if ($objInit->mode == 'frontend') {
             $status = 1;
             $confirmed = $this->arrSettings['confirmFrontendEvents'] == 1 ? 0 : 1;
             $author = $objUser->login() ? intval($objUser->getId()) : 0;
         } else {
             $status = 0;
             $confirmed = 1;
             $author = intval($objUser->getId());
         }
         $formData['status'] = $status;
         $formData['confirmed'] = $confirmed;
         $formData['author'] = $author;
         $query = \SQL::insert("module_{$this->moduleTablePrefix}_event", $formData);
         $objResult = $objDatabase->Execute($query);
         if ($objResult !== false) {
             $id = intval($objDatabase->Insert_ID());
             $this->id = $id;
         } else {
             return false;
         }
     }
     if ($id != 0) {
         foreach ($data['showIn'] as $key => $langId) {
             $title = contrexx_addslashes(contrexx_strip_tags($data['title'][$langId]));
             $description = contrexx_addslashes($data['description'][$langId]);
             if ($convertBBCode) {
                 $description = \Cx\Core\Wysiwyg\Wysiwyg::prepareBBCodeForDb($data['description'][$langId], true);
             }
             $redirect = contrexx_addslashes($data['calendar-redirect'][$langId]);
             if ($type == 0) {
                 $redirect = '';
             } else {
                 $description = '';
             }
             $query = "INSERT INTO " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_event_field\n                            (`event_id`,`lang_id`,`title`, `description`,`redirect`)\n                          VALUES\n                            ('" . intval($id) . "','" . intval($langId) . "','" . $title . "','" . $description . "','" . $redirect . "')";
             $objResult = $objDatabase->Execute($query);
             if ($objResult === false) {
                 return false;
             }
         }
         if (!empty($related_hosts)) {
             foreach ($related_hosts as $key => $hostId) {
                 $query = "INSERT INTO " . DBPREFIX . "module_" . $this->moduleTablePrefix . "_rel_event_host\n                                      (`host_id`,`event_id`) \n                               VALUES ('" . intval($hostId) . "','" . intval($id) . "')";
                 $objResult = $objDatabase->Execute($query);
             }
         }
     }
     if ($send_invitation == 1) {
         $objMailManager = new \Cx\Modules\Calendar\Controller\CalendarMailManager();
         foreach ($invitationTemplate as $templateId) {
             $objMailManager->sendMail(intval($id), \Cx\Modules\Calendar\Controller\CalendarMailManager::MAIL_INVITATION, null, $templateId);
         }
     }
     return true;
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:101,代码来源:CalendarEvent.class.php

示例10: save

 /**
  * Save a record
  * 
  * @global ADO Connection $objDatabase
  * 
  * @return Boolean
  */
 function save()
 {
     global $objDatabase;
     $fields = array('customer_id' => isset($this->customerId) ? $this->customerId : '', 'customer_type' => isset($this->customerType) ? (int) $this->customerType : 0, 'customer_name' => isset($this->customerName) ? $this->customerName : '', 'customer_addedby' => isset($this->addedUser) ? (int) $this->addedUser : 1, 'company_size' => isset($this->companySize) ? $this->companySize : 0, 'customer_currency' => isset($this->currency) ? (int) $this->currency : 0, 'contact_familyname' => isset($this->family_name) ? $this->family_name : '', 'contact_role' => isset($this->contact_role) ? $this->contact_role : '', 'contact_customer' => isset($this->contact_customer) ? (int) $this->contact_customer : '', 'contact_language' => isset($this->contact_language) ? (int) $this->contact_language : '', 'notes' => isset($this->notes) ? $this->notes : '', 'industry_type' => isset($this->industryType) ? $this->industryType : '', 'contact_type' => isset($this->contactType) ? (int) $this->contactType : '', 'user_account' => isset($this->account_id) ? (int) $this->account_id : '', 'gender' => isset($this->contact_gender) ? (int) $this->contact_gender : '', 'profile_picture' => array('val' => isset($this->profile_picture) && !empty($this->profile_picture) ? $this->profile_picture : null, 'omitEmpty' => true), 'email_delivery' => isset($this->emailDelivery) ? contrexx_input2int($this->emailDelivery) : 1);
     if (!isset($this->id) || empty($this->id)) {
         $fields['datasource'] = isset($this->datasource) ? $this->datasource : '';
         $fields['added_date'] = date('Y-m-d H:i:s');
         \Env::get('cx')->getEvents()->triggerEvent('model/prePersist', array(new \Doctrine\ORM\Event\LifecycleEventArgs($this, \Env::get('em'))));
         $query = \SQL::insert("module_{$this->moduleName}_contacts", $fields, array('escape' => true));
     } else {
         \Env::get('cx')->getEvents()->triggerEvent('model/preUpdate', array(new \Doctrine\ORM\Event\LifecycleEventArgs($this, \Env::get('em'))));
         $query = \SQL::update("module_{$this->moduleName}_contacts", $fields, array('escape' => true)) . " WHERE `id` = {$this->id}";
     }
     //echo $query; exit();
     if ($objDatabase->execute($query)) {
         if (!isset($this->id) || empty($this->id)) {
             $this->id = $objDatabase->INSERT_ID();
             \Env::get('cx')->getEvents()->triggerEvent('model/postPersist', array(new \Doctrine\ORM\Event\LifecycleEventArgs($this, \Env::get('em'))));
         } else {
             if (!empty($this->id)) {
                 \Env::get('cx')->getEvents()->triggerEvent('model/postUpdate', array(new \Doctrine\ORM\Event\LifecycleEventArgs($this, \Env::get('em'))));
             }
         }
         return true;
     }
     return false;
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:34,代码来源:CrmContact.class.php

示例11: _modifyTask

 /**
  * add /edit task
  *
  * @global array $_ARRAYLANG
  * @global object $objDatabase
  * @return true
  */
 public function _modifyTask()
 {
     global $_ARRAYLANG, $objDatabase, $objJs, $objFWUser;
     \JS::registerCSS("modules/Crm/View/Style/contact.css");
     if (gettype($objFWUser) === 'NULL') {
         $objFWUser = \FWUser::getFWUserObject();
     }
     $objtpl = $this->_objTpl;
     $_SESSION['pageTitle'] = empty($_GET['id']) ? $_ARRAYLANG['TXT_CRM_ADDTASK'] : $_ARRAYLANG['TXT_CRM_EDITTASK'];
     $this->_objTpl->loadTemplateFile('module_' . $this->moduleNameLC . '_addtasks.html');
     $objtpl->setGlobalVariable("MODULE_NAME", $this->moduleName);
     $settings = $this->getSettings();
     $id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : '';
     $date = date('Y-m-d H:i:s');
     $title = isset($_POST['taskTitle']) ? contrexx_input2raw($_POST['taskTitle']) : '';
     $type = isset($_POST['taskType']) ? (int) $_POST['taskType'] : 0;
     $customer = isset($_REQUEST['customerId']) ? (int) $_REQUEST['customerId'] : '';
     $duedate = isset($_POST['date']) ? $_POST['date'] : $date;
     $assignedto = isset($_POST['assignedto']) ? intval($_POST['assignedto']) : 0;
     $description = isset($_POST['description']) ? contrexx_input2raw($_POST['description']) : '';
     $notify = isset($_POST['notify']);
     $taskId = isset($_REQUEST['searchType']) ? intval($_REQUEST['searchType']) : 0;
     $taskTitle = isset($_REQUEST['searchTitle']) ? contrexx_input2raw($_REQUEST['searchTitle']) : '';
     $redirect = isset($_REQUEST['redirect']) ? $_REQUEST['redirect'] : base64_encode('&act=task');
     // check permission
     if (!empty($id)) {
         $objResult = $objDatabase->Execute("SELECT `added_by`,\n                                                       `assigned_to`\n                                                    FROM `" . DBPREFIX . "module_{$this->moduleNameLC}_task`\n                                                 WHERE `id` = '{$id}'\n                                               ");
         $added_user = (int) $objResult->fields['added_by'];
         $assigned_user = (int) $objResult->fields['assigned_to'];
         if ($objResult) {
             list($task_edit_permission) = $this->getTaskPermission($added_user, $assigned_user);
             if (!$task_edit_permission) {
                 \Permission::noAccess();
             }
         }
     }
     if (isset($_POST['addtask'])) {
         if (!empty($id)) {
             if ($objFWUser->objUser->getAdminStatus() || $added_user == $objFWUser->objUser->getId() || $assigned_user == $assignedto) {
                 $fields = array('task_title' => $title, 'task_type_id' => $type, 'customer_id' => $customer, 'due_date' => $duedate, 'assigned_to' => $assignedto, 'description' => $description);
                 $query = \SQL::update("module_{$this->moduleNameLC}_task", $fields, array('escape' => true)) . " WHERE `id` = {$id}";
                 $_SESSION['strOkMessage'] = $_ARRAYLANG['TXT_CRM_TASK_UPDATE_MESSAGE'];
             } else {
                 $_SESSION['strErrMessage'] = $_ARRAYLANG['TXT_CRM_TASK_RESPONSIBLE_ERR'];
             }
         } else {
             $addedDate = date('Y-m-d H:i:s');
             $fields = array('task_title' => $title, 'task_type_id' => $type, 'customer_id' => $customer, 'due_date' => $duedate, 'assigned_to' => $assignedto, 'added_by' => $objFWUser->objUser->getId(), 'added_date_time' => $addedDate, 'task_status' => '0', 'description' => $description);
             $query = \SQL::insert("module_{$this->moduleNameLC}_task", $fields, array('escape' => true));
             $_SESSION['strOkMessage'] = $_ARRAYLANG['TXT_CRM_TASK_OK_MESSAGE'];
         }
         $db = $objDatabase->Execute($query);
         if ($db) {
             if ($notify) {
                 $cx = \Cx\Core\Core\Controller\Cx::instanciate();
                 $id = !empty($id) ? $id : $objDatabase->INSERT_ID();
                 $info['substitution'] = array('CRM_ASSIGNED_USER_NAME' => contrexx_raw2xhtml(\FWUser::getParsedUserTitle($assignedto)), 'CRM_ASSIGNED_USER_EMAIL' => $objFWUser->objUser->getUser($assignedto)->getEmail(), 'CRM_DOMAIN' => ASCMS_PROTOCOL . "://{$_SERVER['HTTP_HOST']}" . $cx->getCodeBaseOffsetPath(), 'CRM_TASK_NAME' => $title, 'CRM_TASK_LINK' => "<a href='" . ASCMS_PROTOCOL . "://{$_SERVER['HTTP_HOST']}" . $cx->getCodeBaseOffsetPath() . $cx->getBackendFolderName() . "/index.php?cmd=" . $this->moduleName . "&act=task&tpl=modify&id={$id}'>{$title}</a>", 'CRM_TASK_URL' => ASCMS_PROTOCOL . "://{$_SERVER['HTTP_HOST']}" . $cx->getCodeBaseOffsetPath() . $cx->getBackendFolderName() . "/index.php?cmd=" . $this->moduleName . "&act=task&tpl=modify&id={$id}", 'CRM_TASK_DUE_DATE' => $duedate, 'CRM_TASK_CREATED_USER' => contrexx_raw2xhtml(\FWUser::getParsedUserTitle($objFWUser->objUser->getId())), 'CRM_TASK_DESCRIPTION_TEXT_VERSION' => contrexx_html2plaintext($description), 'CRM_TASK_DESCRIPTION_HTML_VERSION' => $description);
                 //setting email template lang id
                 $availableMailTempLangAry = $this->getActiveEmailTemLangId('Crm', CRM_EVENT_ON_TASK_CREATED);
                 $availableLangId = $this->getEmailTempLang($availableMailTempLangAry, $objFWUser->objUser->getUser($assignedto)->getEmail());
                 $info['lang_id'] = $availableLangId;
                 $dispatcher = CrmEventDispatcher::getInstance();
                 $dispatcher->triggerEvent(CRM_EVENT_ON_TASK_CREATED, null, $info);
             }
             \Cx\Core\Csrf\Controller\Csrf::header("Location:./index.php?cmd=" . $this->moduleName . base64_decode($redirect));
             exit;
         }
     } elseif (!empty($id)) {
         $objValue = $objDatabase->Execute("SELECT task_id,\n                                                            task_title,\n                                                            task_type_id,\n                                                            due_date,\n                                                            assigned_to,\n                                                            description,\n                                                            c.id,\n                                                            c.customer_name,\n                                                            c.contact_familyname\n                                                       FROM `" . DBPREFIX . "module_{$this->moduleNameLC}_task` AS t\n                                                       LEFT JOIN `" . DBPREFIX . "module_{$this->moduleNameLC}_contacts` AS c\n                                                            ON t.customer_id = c.id\n                                                       WHERE t.id='{$id}'");
         $title = $objValue->fields['task_title'];
         $type = $objValue->fields['task_type_id'];
         $customer = $objValue->fields['id'];
         $customerName = !empty($objValue->fields['customer_name']) ? $objValue->fields['customer_name'] . " " . $objValue->fields['contact_familyname'] : '';
         $duedate = $objValue->fields['due_date'];
         $assignedto = $objValue->fields['assigned_to'];
         $description = $objValue->fields['description'];
         $taskAutoId = $objValue->fields['task_id'];
     }
     $this->_getResourceDropDown('Members', $assignedto, $settings['emp_default_user_group']);
     $this->taskTypeDropDown($objtpl, $type);
     if (!empty($customer)) {
         // Get customer Name
         $objCustomer = $objDatabase->Execute("SELECT customer_name, contact_familyname  FROM `" . DBPREFIX . "module_crm_contacts` WHERE id = {$customer}");
         $customerName = $objCustomer->fields['customer_name'] . " " . $objCustomer->fields['contact_familyname'];
     }
     $objtpl->setVariable(array('CRM_LOGGED_USER_ID' => $objFWUser->objUser->getId(), 'CRM_TASK_AUTOID' => contrexx_raw2xhtml($taskAutoId), 'CRM_TASK_ID' => (int) $id, 'CRM_TASKTITLE' => contrexx_raw2xhtml($title), 'CRM_DUE_DATE' => contrexx_raw2xhtml($duedate), 'CRM_CUSTOMER_ID' => intval($customer), 'CRM_CUSTOMER_NAME' => contrexx_raw2xhtml($customerName), 'CRM_TASK_DESC' => new \Cx\Core\Wysiwyg\Wysiwyg('description', contrexx_raw2xhtml($description)), 'CRM_BACK_LINK' => base64_decode($redirect), 'TXT_CRM_ADD_TASK' => empty($id) ? $_ARRAYLANG['TXT_CRM_ADD_TASK'] : $_ARRAYLANG['TXT_CRM_EDITTASK'], 'TXT_CRM_TASK_ID' => $_ARRAYLANG['TXT_CRM_TASK_ID'], 'TXT_CRM_TASK_TITLE' => $_ARRAYLANG['TXT_CRM_TASK_TITLE'], 'TXT_CRM_TASK_TYPE' => $_ARRAYLANG['TXT_CRM_TASK_TYPE'], 'TXT_CRM_SELECT_TASK_TYPE' => $_ARRAYLANG['TXT_CRM_SELECT_TASK_TYPE'], 'TXT_CRM_CUSTOMER_NAME' => $_ARRAYLANG['TXT_CRM_CUSTOMER_NAME'], 'TXT_CRM_TASK_DUE_DATE' => $_ARRAYLANG['TXT_CRM_TASK_DUE_DATE'], 'TXT_CRM_TASK_RESPONSIBLE' => $_ARRAYLANG['TXT_CRM_TASK_RESPONSIBLE'], 'TXT_CRM_SELECT_MEMBER_NAME' => $_ARRAYLANG['TXT_CRM_SELECT_MEMBER_NAME'], 'TXT_CRM_OVERVIEW' => $_ARRAYLANG['TXT_CRM_OVERVIEW'], 'TXT_CRM_TASK_DESCRIPTION' => $_ARRAYLANG['TXT_CRM_TASK_DESCRIPTION'], 'TXT_CRM_FIND_COMPANY_BY_NAME' => $_ARRAYLANG['TXT_CRM_FIND_COMPANY_BY_NAME'], 'TXT_CRM_SAVE' => $_ARRAYLANG['TXT_CRM_SAVE'], 'TXT_CRM_BACK' => $_ARRAYLANG['TXT_CRM_BACK'], 'TXT_CRM_NOTIFY' => $_ARRAYLANG['TXT_CRM_NOTIFY'], 'TXT_CRM_MANDATORY_FIELDS_NOT_FILLED_OUT' => $_ARRAYLANG['TXT_CRM_MANDATORY_FIELDS_NOT_FILLED_OUT']));
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:94,代码来源:CrmTask.class.php

示例12: docUploadFinished

 /**
  * the upload is finished
  * rewrite the names
  * write the uploaded files to the database
  *
  * @param string     $tempPath    the temporary file path
  * @param string     $tempWebPath the temporary file path which is accessable by web browser
  * @param array      $data        the data which are attached by uploader init method
  * @param integer    $uploadId    the upload id
  * @param array      $fileInfos   the file infos 
  * 
  * @return array the target paths
  */
 public static function docUploadFinished($tempPath, $tempWebPath, $data, $uploadId, $fileInfos, $response)
 {
     global $objDatabase;
     $objFWUser = \FWUser::getFWUserObject();
     $depositionTarget = \Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteMediaCrmPath() . '/';
     //target folder
     $h = opendir($tempPath);
     if ($h) {
         while (false != ($file = readdir($h))) {
             $info = pathinfo($file);
             //skip . and ..
             if ($file == '.' || $file == '..') {
                 continue;
             }
             if ($file != '..' && $file != '.') {
                 //do not overwrite existing files.
                 $prefix = '';
                 while (file_exists($depositionTarget . $prefix . $file)) {
                     if (empty($prefix)) {
                         $prefix = 0;
                     }
                     $prefix++;
                 }
                 // move file
                 try {
                     $objFile = new \Cx\Lib\FileSystem\File($tempPath . '/' . $file);
                     $objFile->copy($depositionTarget . $prefix . $file, false);
                     // write the uploaded files into database
                     $fields = array('document_name' => trim($prefix . $file), 'added_by' => $objFWUser->objUser->getId(), 'uploaded_date' => date('Y-m-d H:i:s'), 'contact_id' => $data[0]);
                     $sql = \SQL::insert("module_crm_customer_documents", $fields, array('escape' => true));
                     $objDatabase->Execute($sql);
                 } catch (\Cx\Lib\FileSystem\FileSystemException $e) {
                     \DBG::msg($e->getMessage());
                 }
             }
             $arrFiles[] = $file;
         }
         closedir($h);
     }
     // return web- and filesystem path. files will be moved there.
     return array($tempPath, $tempWebPath);
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:55,代码来源:CrmManager.class.php

示例13: intval

 $ps->params = $params;
 if ($ps->checkSignature($_GET['SignatureValue'])) {
     //Данные прошли проверку
     //if($ps->params['Type']=='balance'){
     $rs = $ST->select("SELECT * FROM sc_income \r\n\t\t\t\tWHERE \r\n\t\t\t\t\tuserid=" . intval($ps->params['UserId']) . "\r\n\t\t\t\t\tAND pay_id=" . intval($ps->InvId) . "\r\n\t\t\t\t\tAND type='robokassa'");
     if ($rs->next()) {
         //перевод уже был, всё ок
         echo 'OK' . $_GET['InvId'];
         exit;
     } else {
         if ($ps->params['Type'] == 'balance') {
             //пополним баланс
             $ST->update('sc_users', array('balance=balance+' . floatval($ps->OutSum)), "u_id=" . intval($ps->params['UserId']));
             $rs = $ST->execute("SELECT balance FROM sc_users WHERE u_id=" . intval($ps->params['UserId']));
             if ($rs->next()) {
                 $ST->insert('sc_income', array('userid' => intval($ps->params['UserId']), 'sum' => floatval($ps->OutSum), 'balance' => floatval($rs->getFloat('balance')), 'type' => 'robokassa', 'description' => 'Приход с робокассы', 'pay_id' => intval($ps->InvId), 'pay_string' => $_SERVER['QUERY_STRING']));
             }
         }
         //если указан номер заявки
         if (isset($ps->params['OrderId'])) {
             $rs = $ST->select("SELECT * FROM sc_users WHERE u_id=" . intval($ps->params['UserId']));
             if ($rs->next()) {
                 $user = $rs->getRow();
                 //						$rs=$ST->execute("SELECT * FROM sc_cc_order WHERE userid=".intval($ps->params['UserId'])." AND id=".intval($ps->params['OrderId']));
                 $rs = $ST->select("SELECT * FROM sc_shop_order WHERE userid=" . intval($ps->params['UserId']) . " AND id=" . intval($ps->params['OrderId']));
                 if ($rs->next() && floatval($ps->OutSum) >= $rs->getInt('total_price')) {
                     //							$ST->update('sc_users',array('balance=balance-'.$rs->getInt('summ')),"u_id=".intval($ps->params['UserId']));
                     $ST->update('sc_shop_order', array('pay_time' => date('Y-m-d H:i:s'), 'pay_status' => 'ok'), 'id=' . intval($ps->params['OrderId']));
                     //Оплата заказа
                     $ST->insert('sc_income', array('userid' => intval($ps->params['UserId']), 'sum' => floatval($ps->OutSum), 'type' => 'robokassa', 'description' => "Оплата заказа {$ps->params['OrderId']}", 'pay_id' => intval($ps->InvId), 'pay_string' => $_SERVER['QUERY_STRING']));
                     /*Уведомление*/
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:31,代码来源:result.php

示例14: elseif

             exit;
         } elseif ($ps->operation == 'payment' && !empty($_GET['id_payment'])) {
             $ps->id_payment = $_GET['id_payment'];
             $ps->date = $_GET['date'];
             //1. Смотрим, был ли платёж
             $rs1 = $ST->select("SELECT * FROM sc_pay_income WHERE ext_id={$ps->id_payment}");
             if ($rs1->next()) {
                 $ps->ext_id_payment = $rs1->get('id');
                 $ps->date = date('YmdHis', strtotime($rs1->get('date')));
                 $ps->error = 516;
                 //Дублирование платежа
                 $ps->fatal = true;
                 echo $ps->response();
                 exit;
             } else {
                 $ps->ext_id_payment = $ST->insert('sc_pay_income', array('ext_id' => $ps->id_payment, 'order_id' => $rs->get('id'), 'date' => $date = date('Y-m-d H:i:s'), 'sum' => $ps->sum, 'operator' => 'comepay'));
                 $ST->update('sc_shop_order', array('pay_system' => 'comepay', 'pay_time' => date('Y-m-d H:i:s'), 'pay_status' => 'paid', 'pay_summ=pay_summ+' . $ps->sum), "id=" . $rs->get('id'));
                 $ps->date = date('YmdHis', strtotime($date));
                 $ps->fatal = true;
                 echo $ps->response();
                 exit;
                 //Ура! Заплатили!
             }
         }
     }
 } else {
     $ps->error = 500;
     //Неверный номер абонента
     $ps->fatal = true;
     echo $ps->response();
     exit;
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:31,代码来源:index.php

示例15: checkRecordStoreTODB

 /**
  * Check the argument and save the field values to corresponding DB
  *
  * @param String $tableName Table name
  * @param Array  $values    Conditions
  * @param Array  $fields    Field values
  *
  * @return null
  */
 function checkRecordStoreTODB($tableName = '', $values = array(), $fields = array())
 {
     global $objDatabase;
     if (!empty($tableName) && !empty($fields)) {
         $objRecordExist = $objDatabase->getOne("SELECT id FROM `" . DBPREFIX . "{$tableName}` WHERE {$values['0']} = '" . $values[1] . "' AND contact_id = {$values[2]}");
         if ($objRecordExist && !empty($objRecordExist)) {
             $query = \SQL::update($tableName, $fields, array('escape' => true)) . " WHERE `id` = {$objRecordExist}";
         } else {
             $query = \SQL::insert($tableName, $fields, array('escape' => true));
         }
         $objDatabase->execute($query);
     }
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:22,代码来源:CrmInterface.class.php


注:本文中的SQL::insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。