本文整理汇总了PHP中State类的典型用法代码示例。如果您正苦于以下问题:PHP State类的具体用法?PHP State怎么用?PHP State使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了State类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getState
/**
* For listing the State
* @author Praveen Singh
* @method getState
* @param id
* @return one row of Module Role table
* @since version 0.0.1
* @version 0.2.9
*/
function getState($statId)
{
App::import("Model", "State");
$model = new State();
$datas = $model->find("first", array('conditions' => array('State.id' => $statId)));
return $datas;
}
开发者ID:praveensingh25000,项目名称:Bivid,代码行数:16,代码来源:CommonHelper.php
示例2: parseRequest
public function parseRequest()
{
// init the state library
$state = new State();
// get the request
$request = $state->getInput('request');
if (!empty($request)) {
// explode request
$request_array = explode('/', $request);
if (!empty($request_array)) {
// store the controller
$this->controller = $request_array[0];
}
if (isset($request_array[1])) {
// store the action
$this->action = $request_array[1];
}
if (count($request_array) > 2) {
// foreach extra key
for ($i = 2; $i < count($request_array); $i++) {
// store as a param
$this->params[$i - 2] = $request_array[$i];
}
}
}
}
开发者ID:aboxall,项目名称:Framework,代码行数:26,代码来源:route.php
示例3: __construct
public function __construct($legislation_id = 0)
{
parent::__construct('legislation', $legislation_id);
if ($legislation_id) {
$state = new State($this->region_id());
$logo = LOGO_PATH . strtolower('state_' . $state->state_abbr() . '_' . $this->current_chamber()) . '.png';
$location = $state->state_name() . ' State ' . $this->current_chamber();
list($category_id, $category_name) = Category::legislation_get_category($this->current_location());
$committee = Category::get_location($this->current_location());
$this->legislator_ids = $this->get_legislator_ids();
$legislators = array();
if (!empty($this->legislator_ids)) {
foreach ($this->legislator_ids as $id) {
$legislators[] = new Legislator($id);
}
}
$this->sponsors = Legislation::get_legislator_data($legislators, $committee);
$this->bill = $this->_extract_bill_id();
$this->image = $logo;
$this->bill_location = $location;
$this->location_description = $committee;
$this->category = array('id' => $category_id, 'name' => $category_name);
$this->status = new Status($this->status_id());
$this->date_introduced_parts = get_date_parts($this->date_introduced());
$this->date_heard_parts = get_date_parts($this->date_heard());
$this->_get_public_opinion();
$this->comment_data = $this->get_comment_data();
}
}
开发者ID:rtoews,项目名称:meocracy,代码行数:29,代码来源:class.legislation.php
示例4: getIdentifier
/**
* Returns event identifier
*
* @return string
*/
public function getIdentifier()
{
if (!$this->identifier) {
$this->identifier = sha1(microtime(true) . implode('', $this->tags) . State::getTestSuiteName() . State::getTestClassName() . State::getTestMethodName() . $this->state->getPageUrl());
}
return $this->identifier;
}
开发者ID:Mohitsahu123,项目名称:mtf,代码行数:12,代码来源:Event.php
示例5: displayData
function displayData()
{
$cityTemp = CityManager::getSingleCity('id', $this->church->getIdCity());
if ($cityTemp === NULL) {
$cityTemp = new City();
}
$stateTemp = CityManager::getSingleState('id', $cityTemp->getIdState());
$cityString = "*************************";
if ($stateTemp === NULL) {
$stateTemp = new State();
} else {
$cityString = $cityTemp->getName() . ", " . $stateTemp->getShortName();
}
$this->SetFont('Arial', 'B', 10);
$cellSizeY = 5;
for ($i = 0; $i < 3; $i++) {
//Get the data necesary of create the document
$this->SetXY($x + 100, $i * 60 + $y + 40 - $cellSizeY);
$this->Cell(80, $cellSizeY, iconv('utf-8', 'cp1252', $this->church->getName()), 0, 0, 'C');
$this->SetXY($x + 100, $i * 60 + $y + 47 - $cellSizeY);
$this->Cell(80, $cellSizeY, iconv('utf-8', 'cp1252', $this->church->getAddress()), 0, 0, 'C');
$this->SetXY($x + 100, $i * 60 + $y + 54 - $cellSizeY);
$this->Cell(80, $cellSizeY, iconv('utf-8', 'cp1252', 'CP. ' . $this->church->getPostalCode()), 0, 0, 'C');
$this->SetXY($x + 100, $i * 60 + $y + 61 - $cellSizeY);
$this->Cell(80, $cellSizeY, iconv('utf-8', 'cp1252', $cityString), 0, 0, 'C');
}
}
开发者ID:jonatalamantes,项目名称:NotariusAdOmnes,代码行数:27,代码来源:EnvelopeChurch.php
示例6: testPersist
public function testPersist()
{
$model = new State($this->config, $this->writer);
$constraint = new \PHPUnit_Framework_Constraint_IsInstanceOf('Magento\\Framework\\App\\Cache\\Type\\ConfigSegment');
$this->writer->expects($this->once())->method('update')->with($constraint);
$model->persist();
}
开发者ID:,项目名称:,代码行数:7,代码来源:
示例7: handleException
/**
* Handle exception
*
* @param \Exception $e
* @return void
*/
protected function handleException($e)
{
$needToMaskDisplayMessage = !$e instanceof \Magento\Framework\Exception\LocalizedException && $this->appState->getMode() != State::MODE_DEVELOPER;
$displayMessage = $needToMaskDisplayMessage ? (string) new \Magento\Framework\Phrase('An error occurred while processing your request') : $e->getMessage();
$this->messageManager->addError($displayMessage);
$this->logger->critical($e->getMessage());
}
开发者ID:opexsw,项目名称:magento2,代码行数:13,代码来源:FrontController.php
示例8: cloneState
public static function cloneState(State &$state)
{
$instance = new State($state->getStream());
foreach ($state as $char) {
$instance->appendChar($char);
}
return $instance;
}
开发者ID:ivansky,项目名称:php-dom-query,代码行数:8,代码来源:State.php
示例9: testGetMetadata
public function testGetMetadata()
{
$state = new State('stateName', ['param1' => 'value1', 'param2' => 'value2']);
$this->assertEquals(['param1' => 'value1', 'param2' => 'value2'], $state->getMetadata());
$this->assertEquals('value1', $state->getMetadata('param1'));
$this->assertEquals('value2', $state->getMetadata('param2'));
$this->assertEquals(null, $state->getMetadata('UNEXISTED_KEY'));
}
开发者ID:sokil,项目名称:php-state,代码行数:8,代码来源:StateTest.php
示例10: stateShouldKeepItemsByRuleNumberAndPosition
/**
* @test
*/
public function stateShouldKeepItemsByRuleNumberAndPosition()
{
$item1 = new Item(new Rule(1, 'E', array('E', '+', 'T')), 0);
$state = new State(0, array($item1));
$this->assertSame($item1, $state->get(1, 0));
$item2 = new Item(new Rule(2, 'T', array('T', '+', 'F')), 0);
$state->add($item2);
$this->assertSame($item2, $state->get(2, 0));
}
开发者ID:MPV,项目名称:AspectMock-test,代码行数:12,代码来源:StateTest.php
示例11: valuesFromForm
function valuesFromForm(&$values, State $record)
{
if ($values['_is_disabled']) {
$values['tag'] = $values['tag'] ? $values['tag'] * -1 : -1;
}
if (!$record->pk()) {
$values['state'] = $this->country . '-' . $values['state'];
}
}
开发者ID:grlf,项目名称:eyedock,代码行数:9,代码来源:AdminStatesController.php
示例12: exec
/**
* Execute SampleData module installation.
* Catch exception if it appeared and continue installation
*
* @param InstallerInterface $installer
* @return void
*/
public function exec(InstallerInterface $installer)
{
try {
$this->appState->emulateAreaCode('setup', [$installer, 'install']);
$this->state->setInstalled();
} catch (\Exception $e) {
$this->state->setError();
$this->logger->error('Sample Data error: ' . $e->getMessage());
}
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:17,代码来源:Executor.php
示例13: getStateList
function getStateList($countryCode)
{
App::import("Model", "State");
$model = new State();
$con2 = $model->find('list', array('fields' => array('State.id', 'State.statename'), 'conditions' => array('State.countryid' => $countryCode)));
if (empty($con2)) {
return 0;
} else {
return $con2;
}
}
开发者ID:abhilashjaiswal,项目名称:hrportal,代码行数:11,代码来源:CommonComponent.php
示例14: takeChildFromDOM
/**
* Creates individual Entry objects of the appropriate type and
* stores them as members of this entry based upon DOM data.
*
* @param DOMNode $child The DOMNode to process
*/
protected function takeChildFromDOM($child)
{
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
switch ($absoluteNodeName) {
case $this->lookupNamespace('yt') . ':' . 'state':
$state = new State();
$state->transferFromDOM($child);
$this->_state = $state;
break;
default:
parent::takeChildFromDOM($child);
break;
}
}
开发者ID:rexmac,项目名称:zf2,代码行数:20,代码来源:Control.php
示例15: get
/**
* Returns the state with the given id. If no such state exists, a new
* state is returned.
*/
function get($_id)
{
$_id = 'x';
$state = new State();
$state->id = $_id;
if (!is_readable($this->_filename_of($_id))) {
return $state;
}
$pairs = parse_ini_file($this->_filename_of($_id));
foreach ($pairs as $key => $value) {
$state->set($key, $value);
}
return $state;
}
开发者ID:useada,项目名称:freech-1,代码行数:18,代码来源:statedb.class.php
示例16: actionCreateOrg
public function actionCreateOrg()
{
$org = Organization::model()->count();
if ($org == 0) {
$this->layout = 'installation_layout';
$model = new Organization();
$user = new User();
$auth_assign = new AuthAssignment();
// Uncomment the following line if AJAX validation is needed
$this->performAjaxValidation($model);
if (isset($_POST['Organization']['organization_name']) && !empty($_POST['Organization']['phone']) && !empty($_POST['Organization']['email'])) {
$country_model = new Country();
$country_model->name = $_POST['Organization']['country'];
$country_model->save();
$state_model = new State();
$state_model->state_name = $_POST['Organization']['state'];
$state_model->country_id = $country_model->id;
$state_model->save();
$city_model = new City();
$city_model->city_name = $_POST['Organization']['city'];
$city_model->country_id = $country_model->id;
$city_model->state_id = $state_model->state_id;
$city_model->save();
$model->attributes = $_POST['Organization'];
$model->organization_created_by = 1;
$model->organization_creation_date = new CDbExpression('NOW()');
$model->city = $city_model->city_id;
$model->state = $state_model->state_id;
$model->country = $country_model->id;
if ($model->save(false)) {
$user->user_organization_email_id = $model->email;
$user->user_password = md5($model->email . $model->email);
$user->user_type = 'admin';
$user->user_created_by = 1;
$user->user_creation_date = new CDbExpression('NOW()');
$user->user_organization_id = $model->organization_id;
$user->save();
$auth_assign->itemname = 'SuperAdmin';
$auth_assign->userid = $user->user_id;
$auth_assign->save(false);
$this->redirect(array('redirectLogin'));
}
}
$this->render('create_org', array('model' => $model));
} else {
Yii::app()->user->logout();
$this->redirect(array('login'));
}
}
开发者ID:sharmarakesh,项目名称:EduSec2.0.0,代码行数:49,代码来源:SiteController.php
示例17: testWrite
public function testWrite()
{
$this->store->touch();
$state = new State($this->store, true);
$this->assertTrue($state->isOpen());
$this->assertTrue($state->isMutable());
$data = array('a' => 'foo', 'b' => array('c' => 'bar'), 'd' => array(1, 2, array(1, 2), 4));
$state->override = $data;
$this->assertEquals($data, $state->toArray());
$state->defaults = array('e' => array('f' => 2));
$state->close();
$state = new State($this->store, false);
$this->assertEquals($data, $state->toArray());
$state->close();
}
开发者ID:jivoo,项目名称:jivoo,代码行数:15,代码来源:StateTest.php
示例18: load_states
public function load_states()
{
$country_id = $_POST['country_id'];
$states = new State();
if ($country_id > 0) {
$states->where('country_id', $country_id);
}
$states->get();
echo '<select name="state_id" class="form-control">';
echo '<option value="">-- select state --</option>';
foreach ($states as $key => $state_item) {
echo '<option value="' . $state_item->id . '">' . $state_item->state_name . '</option>';
}
echo '</select>';
}
开发者ID:ultraauchz,项目名称:asean_cultural_mapping,代码行数:15,代码来源:states.php
示例19: getAdminForm
public function getAdminForm()
{
if (empty($this->origincountry)) {
$this->origincountry = (int) _xls_get_conf('DEFAULT_COUNTRY', 224);
}
return array('title' => 'Note: You can ' . CHtml::link('Set Product Restrictions', '#', array('class' => 'basic', 'id' => get_class($this))) . ' for this module.', 'elements' => array('label' => array('type' => 'text', 'maxlength' => 64), 'accnumber' => array('type' => 'text', 'maxlength' => 64), 'meternumber' => array('type' => 'text', 'maxlength' => 64), 'securitycode' => array('type' => 'text', 'maxlength' => 64), 'authkey' => array('type' => 'text', 'maxlength' => 64), 'originadde' => array('type' => 'text', 'maxlength' => 64), 'origincity' => array('type' => 'text', 'maxlength' => 64), 'originpostcode' => array('type' => 'text', 'maxlength' => 64), 'origincountry' => array('type' => 'dropdownlist', 'items' => CHtml::listData(Country::model()->findAllByAttributes(array('active' => 1), array('order' => 'sort_order,country')), 'id', 'country'), 'ajax' => array('type' => 'POST', 'url' => Yii::app()->controller->createUrl('ajax/getstates'), 'data' => 'js:{"' . 'country_id' . '": $("#' . CHtml::activeId($this, 'origincountry') . ' option:selected").val()}', 'update' => '#' . CHtml::activeId($this, 'originstate'))), 'originstate' => array('type' => 'dropdownlist', 'items' => CHtml::listData(State::model()->findAllByAttributes(array('country_id' => $this->origincountry, 'active' => 1), array('order' => 'sort_order,state')), 'id', 'code')), 'offerservices' => array('type' => 'checkboxlist', 'items' => fedex::$service_types, 'separator' => '', 'template' => '<div class="offerservices">{input} {label}</div>', 'label' => 'Offer these services<br><a onclick="selectall()">Select All</a><br><a onclick="selectnone()">Select None</a><br>'), 'packaging' => array('type' => 'dropdownlist', 'items' => array('YOUR_PACKAGING' => 'Your packaging', 'FEDEX_BOX' => 'FedEx Box', 'FEDEX_PAK' => 'FedEx Pak', 'FEDEX_TUBE' => 'FedEx Tube')), 'ratetype' => array('type' => 'dropdownlist', 'items' => array('RATED_LIST' => 'List Rates', 'RATED_ACCOUNT' => 'Negotiated rates')), 'customs' => array('type' => 'dropdownlist', 'items' => array('CLEARANCEFEE' => 'FedEx Handles Customs Clearance', 'NOCHARGE' => 'My store handles Customs Clearance')), 'restrictcountry' => array('type' => 'dropdownlist', 'items' => Country::getAdminRestrictionList(true)), 'markup' => array('type' => 'text', 'maxlength' => 4), 'product' => array('type' => 'text', 'maxlength' => 64)));
}
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:7,代码来源:fedexAdminForm.php
示例20: web_checkin
/**
* (Web service method) Notify WordPress that the bot is online.
* @param mixed[] $args an empty array
* @return mixed[] status; error_message
*/
private function web_checkin($args)
{
$state = State::get_instance();
$state->last_checkin_utc = gmmktime();
$state->save();
return array('status' => 'ok', 'error_message' => '');
}
开发者ID:loonix,项目名称:music-stream-vote,代码行数:12,代码来源:BotService.php
注:本文中的State类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论