本文整理汇总了PHP中Network::from_array方法的典型用法代码示例。如果您正苦于以下问题:PHP Network::from_array方法的具体用法?PHP Network::from_array怎么用?PHP Network::from_array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Network
的用法示例。
在下文中一共展示了Network::from_array方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save($id = null)
{
if ($this->perm->can_create == 'y') {
if ($_POST) {
$save = new Network();
if ($_POST['id'] == '') {
$show_no = $this->db->query("SELECT MAX(show_no)show_no FROM acm_network")->result();
$_POST['show_no'] = @$show_no[0]->show_no < 1 ? 1 : $show_no[0]->show_no + 1;
$_POST['created_by'] = $this->user->id;
} else {
$_POST['updated_by'] = $this->user->id;
}
$save->from_array($_POST);
$save->save();
$action = $_POST['id'] > 0 ? 'UPDATE' : 'CREATE';
save_logs($this->menu_id, $action, @$save->id, $action . ' ' . $save->title . ' Network');
}
}
redirect("admin/networks");
}
示例2: get_mothership_info
/**
* get the details of mother network
* @access public.
* @param array of parameters
* format of $params
* @return mother network details
*/
public static function get_mothership_info()
{
Logger::log("[ Enter: function Network::get_mothership_info] \n");
$sql = " SELECT * FROM {networks} WHERE is_active = 1 AND type = " . MOTHER_NETWORK_TYPE;
$network = Dal::query_one_assoc($sql);
if (empty($network)) {
throw new PAException(MOTHER_NETWORK_NOT_DEFINED, "Configuration error: Mother network not configured.");
}
// we ned to set the network owner proprly
// as it is set to 0 by default, which is not actually true
if ($network['owner_id'] < 1) {
// we use id = 1 for now as it seems there is no way to set it
$network['owner_id'] = 1;
}
return Network::from_array($network);
Logger::log("[ Exit: function Network::get_mothership_info] \n");
}