本文整理汇总了PHP中arrayToObject函数的典型用法代码示例。如果您正苦于以下问题:PHP arrayToObject函数的具体用法?PHP arrayToObject怎么用?PHP arrayToObject使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了arrayToObject函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
$this->status = 1;
$this->status_array = arrayToObject(array(array('id' => 1, 'name' => "Active"), array('id' => 0, 'name' => "Deactive")));
$this->size_array = arrayToObject(array(array('id' => "normal", 'name' => "normal"), array('id' => "large", 'name' => "large")));
$this->date = date('Y-m-d H:i:s');
}
示例2: _index
public static function _index($div, $plt)
{
$division = Division::findByName(strtolower($div));
$platoonId = Platoon::getIdFromNumber($plt, $division->id);
if (!is_null($platoonId)) {
$user = User::find(intval($_SESSION['userid']));
$member = Member::find(intval($_SESSION['memberid']));
$tools = Tool::find_all($user->role);
$divisions = Division::find_all();
$platoon = Platoon::findById($platoonId);
$members = arrayToObject(Platoon::members($platoonId));
$js = 'platoon';
$memberIdList = Platoon::memberIdsList($platoonId);
$activity = arrayToObject(Platoon::forumActivity($platoonId));
$bdate = date("Y-m-d", strtotime("now - 30 days"));
$edate = date("Y-m-d", strtotime("now"));
$div = $division->id;
Flight::render('platoon/main/statistics', compact('platoon', 'activity'), 'statistics');
Flight::render('platoon/main/members', compact('division', 'members', 'js', 'bdate', 'edate'), 'membersTable');
Flight::render('platoon/main/index', compact('user', 'member', 'division', 'platoon', 'memberIdList', 'plt', 'div', 'members', 'platoonId'), 'content');
Flight::render('layouts/application', compact('user', 'member', 'tools', 'divisions'));
} else {
Flight::redirect('404/', 404);
}
}
示例3: members
public static function members($squad_id)
{
// finds active, LOAs, and pending members
$sql = "SELECT * FROM " . Member::$table . " WHERE squad_id = {$squad_id} AND (status_id = 1 OR status_id = 3 OR status_id = 999)";
$sql .= " ORDER BY member.rank_id DESC, member.join_date DESC";
return arrayToObject(Flight::aod()->sql($sql)->many());
}
示例4: setUp
public function setUp()
{
$config = array('mysql' => array('mySqlDb' => 'foo', 'mySqlHost' => 'bar', 'mySqlUser' => 'foo', 'mySqlPassword' => 'bar'), 'user' => array('email' => 'test@example.com'), 'application' => array('appId' => 'fooId'));
$config = arrayToObject($config);
$params = array('db' => true);
$this->db = new DatabaseMySqlOverride($config, $params);
}
示例5: login
public function login($referer = '')
{
if ($this->loggedUser->Admin->id > 0) {
$this->redirect($this->request->webroot);
}
$referer = urldecode($referer);
$this->layout = "login";
if (!empty($this->request->data)) {
$admin = $this->UserAdmin->findByEmail($this->request->data['UserAdmin']['email']);
$this->setCookie();
if (empty($admin) || $admin['UserAdmin']['password'] != sha1($this->request->data['UserAdmin']['password'])) {
$this->Session->setFlash(__('The email or password you entered is incorrect.'), 'flash/error');
} elseif ($admin['UserAdmin']['status'] == USER_ADMIN_DISABLE) {
$this->Session->setFlash(__('Your account has been disabled.'), 'flash/error');
} else {
$this->loggedUser = new stdClass();
$this->loggedUser->User = new stdClass();
$this->loggedUser->User->id = 0;
unset($admin['UserAdmin']['password']);
$this->loggedUser->Admin = arrayToObject($admin['UserAdmin']);
$this->Session->write('loggedUser', $this->loggedUser);
$this->redirect($referer);
}
}
}
示例6: setUp
public function setUp()
{
$config = array('credentials' => array('awsKey' => 'foo', 'awsSecret' => 'bar'), 'aws' => array('s3BucketName' => 'foo', 's3Host' => 'bar'));
$config = arrayToObject($config);
$params = array('db' => true);
$this->fs = new FileSystemS3Override($config, $params);
}
示例7: findByDivision
public static function findByDivision($game_id, $limit = false)
{
if (!$limit) {
$limit = 10;
}
return arrayToObject(Flight::aod()->from(self::$table)->where(array("member.game_id" => $game_id))->limit($limit)->sortDesc('date')->join('actions', array('actions.id' => 'user_actions.type_id'))->join('member', array('member.member_id' => 'user_actions.target_id'))->select(array('date', 'user_id', 'type_id', 'target_id', 'verbage', 'icon'))->many());
}
示例8: _manage_inactives
public static function _manage_inactives()
{
$user = User::find(intval($_SESSION['userid']));
$member = Member::find(intval($_SESSION['memberid']));
$tools = Tool::find_all($user->role);
$divisions = Division::find_all();
switch ($user->role) {
case User::isDev():
$type = "div";
$id = $member->game_id;
break;
case 1:
$type = "sqd";
//$id = $member->squad_id; break;
//$id = $member->squad_id; break;
case 2:
$type = "plt";
$id = $member->platoon_id;
break;
case 3:
$type = "div";
$id = $member->game_id;
break;
default:
$type = "div";
$id = $member->game_id;
break;
}
$flagged_inactives = Member::findInactives($id, $type, true);
$flaggedCount = count($flagged_inactives) ? count($flagged_inactives) : 0;
$inactives = Member::findInactives($id, $type);
$inactiveCount = count($inactives) ? count($inactives) : 0;
Flight::render('manage/inactive_members', array('member' => $member, 'user' => $user, 'inactives' => arrayToObject($inactives), 'flagged' => arrayToObject($flagged_inactives), 'flaggedCount' => $flaggedCount, 'inactiveCount' => $inactiveCount), 'content');
Flight::render('layouts/application', array('user' => $user, 'member' => $member, 'tools' => $tools, 'divisions' => $divisions, 'js' => 'manage'));
}
示例9: setUp
public function setUp()
{
$config = array('credentials' => array('awsKey' => 'foo', 'awsSecret' => 'bar'), 'aws' => array('simpleDbDomain' => 'sdbdomain'), 'user' => array('email' => 'test@example.com'), 'application' => array('appId' => 'fooId'));
$config = arrayToObject($config);
$params = array('db' => true);
$this->db = new DatabaseSimpleDbOverride($config, $params);
}
示例10: getByName
/**
* @param $name
* @return null
*/
public function getByName($name)
{
foreach ($this->data as $val) {
if ($val['name'] == $name) {
return arrayToObject($val['name']);
}
}
return null;
}
示例11: arrayToObject
function arrayToObject($array)
{
foreach ($array as $key => $value) {
if (is_array($value)) {
$array[$key] = arrayToObject($value);
}
}
return (object) $array;
}
示例12: create
protected function create($id)
{
$this->apiType = (new \Member\Open\Type())->getById($id);
if (!$this->apiType) {
throw new \Exception('没有开通的第三方接入');
}
//init api
$config = arrayToObject(C("open:" . $this->apiType->key));
$this->openApi = \System\Library\Open\OpenFactory::createOpenApi($this->apiType->key, $config);
}
示例13: findSquadLeaders
public static function findSquadLeaders($gid, $order_by_rank = false)
{
$sql = "SELECT last_activity, rank.abbr, member_id, forum_name, platoon.name, member.battlelog_name FROM " . Member::$table . " LEFT JOIN platoon ON platoon.id = member.platoon_id LEFT JOIN rank ON rank.id = member.rank_id WHERE member.game_id = {$gid} AND position_id = 5";
if ($order_by_rank) {
$sql .= " ORDER BY member.rank_id DESC, member.forum_name ASC ";
} else {
$sql .= " ORDER BY platoon.id, forum_name";
}
$params = Flight::aod()->sql($sql)->one();
return arrayToObject($params);
}
示例14: arrayToObject
function arrayToObject($e)
{
if (gettype($e) != 'array') {
return;
}
foreach ($e as $k => $v) {
if (gettype($v) == 'array' || getType($v) == 'object') {
$e[$k] = (object) arrayToObject($v);
}
}
return (object) $e;
}
示例15: setUp
public function setUp()
{
$this->file = 'file.jpg';
$this->photo = array('id' => 'foo', 'path10x10' => "/{$this->file}");
if (class_exists('vfsStream')) {
vfsStreamWrapper::register();
vfsStreamWrapper::setRoot(new vfsStreamDirectory('fsDir'));
$this->root = vfsStream::url('fsDir');
$this->assertFalse(vfsStreamWrapper::getRoot()->hasChild($this->file), 'Init validation that vfs file does not exist failed');
}
$this->vfsPath = sprintf('%s%s', $this->root, $this->photo['path10x10']);
$this->host = 'http://test';
$config = array('localfs' => array('fsRoot' => $this->root, 'fsHost' => $this->host), 'paths' => array('temp' => sys_get_temp_dir()));
$config = arrayToObject($config);
$params = array('db' => true);
$this->fs = new FileSystemLocal($config, $params);
}