當前位置: 首頁>>代碼示例>>PHP>>正文


PHP State::update方法代碼示例

本文整理匯總了PHP中State::update方法的典型用法代碼示例。如果您正苦於以下問題:PHP State::update方法的具體用法?PHP State::update怎麽用?PHP State::update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在State的用法示例。


在下文中一共展示了State::update方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: createStates

 private static function createStates()
 {
     $ps_state_iso_code_max_length = 7;
     if (version_compare(_PS_VERSION_, '1.5', '<')) {
         $ps_state_iso_code_max_length = 4;
     }
     foreach (SeurLib::$baleares_states as $iso_code => $state_name) {
         if (Tools::strlen($iso_code) > $ps_state_iso_code_max_length) {
             $tmpArray = explode('-', $iso_code);
             $iso_code = $tmpArray[0];
             if (count($tmpArray) > 0) {
                 $iso_code = 'E' . $tmpArray[1];
             }
         }
         $exists_id = State::getIdByIso($iso_code);
         if (isset($exists_id) && !empty($exists_id)) {
             $state = new State($exists_id);
             $state->active = true;
             $state->id_zone = self::$baleares->id;
             if (!$state->update()) {
                 return false;
             }
         } else {
             $state = new State();
             $state->name = $state_name;
             $state->id_country = self::$spain->id;
             $state->id_zone = self::$baleares->id;
             $state->iso_code = $iso_code;
             $state->active = true;
             if (!$state->save()) {
                 return false;
             }
         }
     }
     foreach (SeurLib::$canarias_states as $iso_code => $state_name) {
         if (Tools::strlen($iso_code) > $ps_state_iso_code_max_length) {
             $tmpArray = explode('-', $iso_code);
             $iso_code = $tmpArray[0];
             if (count($tmpArray) > 0) {
                 $iso_code = 'E' . $tmpArray[1];
             }
         }
         $exists_id = State::getIdByIso($iso_code);
         if (isset($exists_id) && !empty($exists_id)) {
             $state = new State($exists_id);
             $state->active = true;
             $state->id_zone = self::$canarias->id;
             if (!$state->update()) {
                 return false;
             }
         } else {
             $state = new State();
             $state->name = $state_name;
             $state->id_country = self::$spain->id;
             $state->id_zone = self::$canarias->id;
             $state->iso_code = $iso_code;
             $state->active = true;
             if (!$state->save()) {
                 return false;
             }
         }
     }
     foreach (SeurLib::$ceuta_melilla_states as $iso_code => $state_name) {
         if (Tools::strlen($iso_code) > $ps_state_iso_code_max_length) {
             $tmpArray = explode('-', $iso_code);
             $iso_code = $tmpArray[0];
             if (count($tmpArray) > 0) {
                 $iso_code = 'E' . $tmpArray[1];
             }
         }
         $exists_id = State::getIdByIso($iso_code);
         if (isset($exists_id) && !empty($exists_id)) {
             $state = new State($exists_id);
             $state->id_zone = self::$ceuta_melilla->id;
             $state->active = true;
             if (!$state->update()) {
                 return false;
             }
         } else {
             $state = new State();
             $state->name = $state_name;
             $state->id_country = self::$spain->id;
             $state->id_zone = self::$ceuta_melilla->id;
             $state->iso_code = $iso_code;
             $state->active = true;
             if (!$state->save()) {
                 return false;
             }
         }
     }
     foreach (SeurLib::$spain_states as $iso_code => $state_name) {
         if (Tools::strlen($iso_code) > $ps_state_iso_code_max_length) {
             $tmpArray = explode('-', $iso_code);
             $iso_code = $tmpArray[0];
             if (count($tmpArray) > 0) {
                 $iso_code = 'E' . $tmpArray[1];
             }
         }
         $exists_id = State::getIdByIso($iso_code);
         if (isset($exists_id) && !empty($exists_id)) {
//.........這裏部分代碼省略.........
開發者ID:tomideru,項目名稱:PrestaShop-modules,代碼行數:101,代碼來源:Range.php

示例2: State

<?php

include_once $CFG->dirroot . "/lib/classes/" . "application/State.Class.php5";
$StateObj = new State();
$GeneralObj->getRequestVars();
$StateObj->setAllVar();
$redirect_file = "index.php?file=t-state_masteradd&mode={$mode}&iId={$iStateId}";
$message = "State Already Exist";
$GeneralObj->checkDuplicate('iStateId', 'state_master', array('vStateCode', 'vCountryCode'), $redirect_file, $message, $iStateId, ' AND ');
if ($mode == "Add") {
    $StateObj->insert();
    $msg = MSG_ADD;
    header("Location:index.php?file=State&AX=Yes&var_msg={$msg}");
    exit;
} else {
    if ($mode == "Update") {
        $StateObj->update($iStateId);
        $msg = MSG_UPDATE;
        header("Location:index.php?file=State&AX=Yes&var_msg={$msg}");
        exit;
    }
}
開發者ID:redeyes1024,項目名稱:medlii_mlm_backend,代碼行數:22,代碼來源:state_masteradd_a.php

示例3: array

$Data['vCountryCode'] = $cntcode[0]['vCountryCode'];
/** This is for Check Duplicate Record-------------------------------------------*/
$generalobj->getRequestVars();
$redirect_file = "index.php?file={$file}&view={$view}&iStateId={$iStateId}";
$generalobj->checkDuplicate('iStateId', PRJ_DB_PREFIX . "_state_master", array('vState' => $Data['vState']), $redirect_file, STATE_ALREADY_EXISTS, $iStateId);
if ($view == "add") {
    //prints($Data);exit;
    $stateObj->setAllVar($Data);
    $id = $stateObj->insert();
    if ($id) {
        $var_msg = "Record Added Successfully.";
    } else {
        $var_msg = "Eror-in Add.";
    }
} else {
    if ($view == "edit") {
        //prints($Data);exit;
        $arr = $stateObj->select($iStateId);
        $stateObj->setAllVar($arr);
        $stateObj->setAllVar($Data);
        $where = " iStateId = '" . $iStateId . "'";
        $id = $stateObj->update($where);
        if ($id) {
            $var_msg = "Record Updated Successfully.";
        } else {
            $var_msg = "Eror-in Update.";
        }
    }
}
header("Location:index.php?file=ge-state&view=index&AX=Yes&var_msg={$var_msg}");
exit;
開發者ID:nstungxd,項目名稱:F2CA5,代碼行數:31,代碼來源:addstate_a.php

示例4: Rating

    $ratingDAO = new Rating();
    $ratingDAO->delete($rating);
    echo '{"result":"ok"}';
});
$app->get('/state', function () {
    $stateDAO = new State();
    $result = $stateDAO->get();
    echo json_encode($result);
});
$app->post('/state', function () {
    $request = \Slim\Slim::getInstance()->request();
    $state = json_decode($request->getBody());
    $stateDAO = new State();
    $stateDAO->insert($state);
    echo '{"result":"ok"}';
});
$app->put('/state', function () {
    $request = \Slim\Slim::getInstance()->request();
    $state = json_decode($request->getBody());
    $stateDAO = new State();
    $stateDAO->update($state);
    echo '{"result":"ok"}';
});
$app->delete('/state', function () {
    $request = \Slim\Slim::getInstance()->request();
    $state = json_decode($request->getBody());
    $stateDAO = new State();
    $stateDAO->delete($state);
    echo '{"result":"ok"}';
});
$app->run();
開發者ID:,項目名稱:,代碼行數:31,代碼來源:


注:本文中的State::update方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。