本文整理汇总了PHP中Website::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Website::save方法的具体用法?PHP Website::save怎么用?PHP Website::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Website
的用法示例。
在下文中一共展示了Website::save方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_website
function save_website($datas)
{
global $templatesList;
load_lib();
//Etape 1 : sauvegarde du site
require_once MODELS . DS . 'website.php';
$websiteModel = new Website();
$templateId = $datas['template_id'];
$template = $templatesList[$templateId];
$datas['tpl_layout'] = $template['layout'];
$datas['tpl_code'] = $template['code'];
$datas['search_engine_position'] = 'header';
$datas['created_by'] = 1;
$datas['modified_by'] = 1;
$datas['online'] = 1;
$websiteModel->save($datas);
define('CURRENT_WEBSITE_ID', $websiteModel->id);
//Etape 2 : sauvegarde du menu racine
require_once MODELS . DS . 'category.php';
$categoryModel = new Category();
unset($categoryModel->searches_params);
////////////////////////////////////////////////////////
// INITIALISATION DE LA CATEGORIE PARENTE DU SITE //
$categorie = array('parent_id' => 0, 'type' => 3, 'name' => 'Racine Site ' . $websiteModel->id, 'slug' => 'racine-site-' . $websiteModel->id, 'online' => 1, 'redirect_category_id' => 0, 'display_contact_form' => 0, 'website_id' => $websiteModel->id);
$categoryModel->save($categorie);
return $websiteModel->id + $categoryModel->id;
}
示例2: create
public function create()
{
$website = new Website();
if ($this->post) {
$website->name = $this->PostData('name');
$website->description = $this->PostData('description');
$website->url = $this->PostData('url');
$website->loginurl = $this->PostData('loginurl');
$website->triggerurl = $this->PostData('triggerurl');
$website->code = $this->PostData('code');
if ($website->save()) {
Site::flash('notice', 'The site has been created');
Redirect('admin/sites');
}
}
$this->assign('website', $website);
$this->title = 'New Site';
$this->render('website/create.tpl');
}
示例3: add
/**
* @before _secure, memberLayout
*/
public function add()
{
$this->seo(array("title" => "Create a Trigger for your website", "view" => $this->getLayoutView()));
$view = $this->getActionView();
if (RequestMethods::post('action') == 'addWebsite') {
$name = RequestMethods::post('name');
$url = RequestMethods::post('url');
$url = preg_replace('/^https?:\\/\\//', '', $url);
$url = rtrim($url, "/");
// Check if the domain already exists
$website = Website::first(array("url = ?" => $url));
if ($website) {
$view->set("message", "Website Already exists");
} else {
$doc = array("title" => $name, "url" => $url, "user_id" => (int) $this->user->id, "live" => true);
$website = new Website($doc);
$website->save();
$collection = Registry::get("MongoDB")->selectCollection("website");
$collection->insert(array_merge($doc, array('website_id' => (int) $website->id)));
$view->set("message", "Website Added Successfully");
}
}
}
示例4: createWebsite
public function createWebsite()
{
$user_id = Auth::user()->id;
$rules = array('title' => 'required', 'type' => 'required', 'account_id' => 'required');
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::to('/websites/new')->withErrors($validator)->withInput();
} else {
$client = new GuzzleHttp\Client();
$title = Input::get('title');
$tagline = Input::get('tagline');
$about = Input::get('about');
$type = Input::get('type');
$account_id = Input::get('account_id');
$domain_name = Input::get('domain_name');
$is_public = 0;
if (Input::has('public')) {
$is_public = 1;
}
$website = new Website();
$website->user_id = $user_id;
$website->long_id = Str::slug(substr($title, 0, 160) . '-' . str_random(6));
$website->type = $type;
$website->domain_name = $domain_name;
$website->title = $title;
$website->tagline = $tagline;
$website->about = $about;
$website->public = $is_public;
$website->save();
$website_id = $website->id;
if ($type == 'youtube') {
$youtube = new Youtube(array('key' => Config::get('keys.youtube')));
$youtube_channel = $youtube->getChannelByName($account_id);
$site_channel_id = $youtube_channel->id;
$site_channel_title = $youtube_channel->snippet->title;
$site_channel_description = $youtube_channel->snippet->description;
$site_channel_thumbnail = $youtube_channel->snippet->thumbnails->high->url;
} else {
if ($type == 'vimeo') {
$vimeo = $client->get("http://vimeo.com/api/v2/{$account_id}/info.json");
$vimeo_channel = json_decode($vimeo->getBody(), true);
$site_channel_id = $vimeo_channel['id'];
$site_channel_title = $vimeo_channel['display_name'];
$site_channel_description = strip_tags($vimeo_channel['bio']);
$site_channel_thumbnail = $vimeo_channel['portrait_huge'];
}
}
$channel = new Channel();
$channel->user_id = $user_id;
$channel->website_id = $website_id;
$channel->channel_id = $site_channel_id;
$channel->title = $site_channel_title;
$channel->description = $site_channel_description;
$channel->thumbnail = $site_channel_thumbnail;
$channel->save();
$channel_id = $channel->id;
$next_playlisttoken = '';
if ($type == 'youtube') {
do {
$playlists = $youtube->getPlaylistsByChannelId($youtube_channel->id, array('maxResults' => 50, 'pageToken' => $next_playlisttoken));
$next_playlisttoken = $youtube->page_info;
if (!empty($playlists)) {
foreach ($playlists as $pl) {
//only cached playlists that are public
if ($pl->status->privacyStatus == 'public') {
$playlist_id = $pl->id;
$playlist_params['body'] = array('id' => $playlist_id, 'user_id' => $user_id, 'website_id' => $website_id, 'channel_id' => $channel_id, 'title' => $pl->snippet->title, 'playlist_type' => 'youtube', 'description' => $pl->snippet->description, 'thumbnail' => $pl->snippet->thumbnails->high->url, 'published_at' => $pl->snippet->publishedAt);
$playlist_params['index'] = 'video-websites';
$playlist_params['type'] = 'playlist';
$playlist_params['id'] = $playlist_id;
$ret = Es::index($playlist_params);
$next_videostoken = '';
do {
$playlist_items = $youtube->getPlaylistItemsByPlaylistId($playlist_id, array('maxResults' => 50, 'pageToken' => $next_videostoken));
$next_videostoken = $youtube->page_info;
if (!empty($playlist_items)) {
foreach ($playlist_items as $video) {
if ($video->status->privacyStatus == 'public') {
$video_id = $video->id;
$video_params['body'] = array('id' => $video_id, 'video_id' => $video->contentDetails->videoId, 'user_id' => $user_id, 'website_id' => $website_id, 'channel_id' => $channel_id, 'playlist_id' => $playlist_id, 'video_type' => 'youtube', 'position' => $video->snippet->position, 'title' => $video->snippet->title, 'description' => $video->snippet->description, 'thumbnails' => array('small' => $video->snippet->thumbnails->default->url, 'medium' => $video->snippet->thumbnails->medium->url, 'large' => $video->snippet->thumbnails->high->url), 'published_at' => $video->snippet->publishedAt);
$video_params['index'] = 'video-websites';
$video_params['type'] = 'video';
$video_params['id'] = $video_id;
$ret = Es::index($video_params);
}
}
}
} while (is_string($next_videostoken));
}
}
}
} while (is_string($next_playlisttoken));
} else {
if ($type == 'vimeo') {
$playlists_response = $client->get("http://vimeo.com/api/v2/{$account_id}/channels.json");
$playlists = json_decode($playlists_response->getBody(), true);
if (!empty($playlists)) {
foreach ($playlists as $pl) {
$playlist_id = $pl['id'];
$playlist_params['body'] = array('id' => $playlist_id, 'user_id' => $user_id, 'website_id' => $website_id, 'channel_id' => $channel_id, 'title' => $pl['name'], 'playlist_type' => 'vimeo', 'description' => $pl['description'], 'thumbnail' => $pl['logo'], 'published_at' => $pl['created_on']);
//.........这里部分代码省略.........
示例5: InitData
function InitData($project_name)
{
$listPageType = 'list_types';
$c = new Criteria();
$c->add(ListsPeer::LIST_ID, $listPageType);
$listExist = ListsPeer::doSelectOne($c);
if (!$listExist) {
echo "Creating list 'list_type'...\n";
$newList = new Lists();
$newList->setLabel('List Types');
$newList->setListid($listPageType);
$newList->setListtype('system');
$newList->save();
$newItem = new Listitem();
$newItem->setLabel('System list');
$newItem->setValue('system');
$newItem->save(null, $newList);
$newItem = new Listitem();
$newItem->setLabel('Static list');
$newItem->setValue('static');
$newItem->save(null, $newList);
$newItem = new Listitem();
$newItem->setLabel('Editable list');
$newItem->setValue('editable');
$newItem->save(null, $newList);
}
$listPageType = 'page_types';
$c = new Criteria();
$c->add(ListsPeer::LIST_ID, $listPageType);
$listExist = ListsPeer::doSelectOne($c);
if (!$listExist) {
echo "Creating list 'page_types'...\n";
$newList = new Lists();
$newList->setLabel('Page Types');
$newList->setListid($listPageType);
$newList->setListtype('system');
$newList->save();
$newItem = new Listitem();
$newItem->setLabel('Content page');
$newItem->setValue('CONTENT');
$newItem->save(null, $newList);
$newItem = new Listitem();
$newItem->setLabel('Page reference');
$newItem->setValue('REFERENCE');
$newItem->save(null, $newList);
$newItem = new Listitem();
$newItem->setLabel('External page');
$newItem->setValue('EXTERNAL');
$newItem->save(null, $newList);
}
$cultureType = 'culture';
$c = new Criteria();
$c->add(ListsPeer::LIST_ID, $cultureType);
$listExist = ListsPeer::doSelectOne($c);
if (!$listExist) {
echo "Creating list 'culture'...\n";
$newList = new Lists();
$newList->setLabel('Culture');
$newList->setListid($cultureType);
$newList->setListtype('system');
$newList->save();
$newItem = new Listitem();
$newItem->setLabel('english');
$newItem->setValue('en');
$newItem->save(null, $newList);
/* $newItem = new Listitem();
$newItem->setLabel('български');
$newItem->setValue('bg');
$newItem->save(null, $newList);*/
}
$userType = 'usertype';
$c = new Criteria();
$c->add(ListsPeer::LIST_ID, $userType);
$listExist = ListsPeer::doSelectOne($c);
if (!$listExist) {
echo "Creating list 'user types'...\n";
$newList = new Lists();
$newList->setLabel('User Types');
$newList->setListid($userType);
$newList->setListtype('system');
$newList->save();
$newItem = new Listitem();
$newItem->setLabel('Administrator (all rights)');
$newItem->setValue('admin');
$newItem->save(null, $newList);
$newItem = new Listitem();
$newItem->setLabel('Editor (no access to administration modules)');
$newItem->setValue('editor');
$newItem->save(null, $newList);
$newItem = new Listitem();
$newItem->setLabel('Editor (edit and save existing items)');
$newItem->setValue('restricted_editor');
$newItem->save(null, $newList);
}
$Mailinglist_Folder = Document::getDocumentByExclusiveTag('newsletter_folder_mailinglist');
if (!$Mailinglist_Folder) {
$Newsletter_Root = Rootfolder::getRootfolderByModule('Newsletter');
$Mailinglist_Folder = new Folder();
$Mailinglist_Folder->setLabel('Mailing lists');
$Mailinglist_Folder->save(null, $Newsletter_Root);
//.........这里部分代码省略.........
示例6: array
$websites = Website::where('environmentId', '=', $environmentId)->get();
$response = array();
$response['success'] = 1;
$response['websites'] = $websites->toArray();
echo json_encode($response);
}
}
});
$app->post('/website', function () {
session_start();
session_regenerate_id();
if (isset($_SESSION['userId'])) {
$url = $_POST['url'];
$environmentId = $_POST['environmentId'];
$website = new Website(array('userId' => $_SESSION['userId'], 'domainName' => $url, 'environmentId' => $environmentId));
$website->save();
$response['success'] = 1;
$response['website'] = $website->toArray();
echo json_encode($response);
} else {
echo json_encode(array('success' => 0));
}
});
$app->post('/task-goal', function () {
session_start();
session_regenerate_id();
if (isset($_SESSION['userId'])) {
$userId = $_SESSION['userId'];
$name = $_POST['name'];
$startDate = $_POST['startDate'];
$endDate = $_POST['endDate'];