本文整理匯總了PHP中models\SiteModel::getIsFeatureCuratedList方法的典型用法代碼示例。如果您正苦於以下問題:PHP SiteModel::getIsFeatureCuratedList方法的具體用法?PHP SiteModel::getIsFeatureCuratedList怎麽用?PHP SiteModel::getIsFeatureCuratedList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models\SiteModel
的用法示例。
在下文中一共展示了SiteModel::getIsFeatureCuratedList方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: create
public function create(SiteModel $site, UserAccountModel $owner, $countries, SiteQuotaModel $siteQuota, $canAnyUserVerifiedEdit = false)
{
global $DB, $CONFIG, $EXTENSIONHOOKRUNNER;
$createdat = \TimeSource::getFormattedForDataBase();
if (!$site->isSlugValid($site->getSlug(), $CONFIG)) {
throw new Exception("Slug not valid");
}
try {
$DB->beginTransaction();
// TODO should check slug not already exist and nice error
$timezones = array();
foreach ($countries as $country) {
foreach (explode(",", $country->getTimezones()) as $timeZone) {
$timezones[] = $timeZone;
}
}
$site->setCachedTimezonesAsList($timezones);
$site->setCachedIsMultipleCountries(count($countries) > 1);
// Site
$stat = $DB->prepare("INSERT INTO site_information (title, slug, slug_canonical, " . "created_at,cached_is_multiple_timezones,cached_is_multiple_countries," . "cached_timezones,is_feature_map,is_feature_importer,is_feature_curated_list," . "is_listed_in_index,is_web_robots_allowed, " . " prompt_emails_days_in_advance,site_quota_id, " . "is_feature_tag,is_feature_physical_events,is_feature_virtual_events) " . "VALUES (:title, :slug, :slug_canonical, " . " :created_at,:cached_is_multiple_timezones,:cached_is_multiple_countries," . ":cached_timezones,:is_feature_map,:is_feature_importer,:is_feature_curated_list," . ":is_listed_in_index,:is_web_robots_allowed, " . " :prompt_emails_days_in_advance, :site_quota_id, " . ":is_feature_tag,:is_feature_physical_events,:is_feature_virtual_events) RETURNING id");
$stat->execute(array('title' => substr($site->getTitle(), 0, VARCHAR_COLUMN_LENGTH_USED), 'slug' => $site->getSlug(), 'slug_canonical' => SiteModel::makeCanonicalSlug($site->getSlug()), 'cached_is_multiple_timezones' => $site->getCachedIsMultipleTimezones() ? 1 : 0, 'cached_is_multiple_countries' => $site->getCachedIsMultipleCountries() ? 1 : 0, 'cached_timezones' => $site->getCachedTimezones(), 'created_at' => $createdat, 'is_feature_curated_list' => $site->getIsFeatureCuratedList() ? 1 : 0, 'is_feature_importer' => $site->getIsFeatureImporter() ? 1 : 0, 'is_feature_map' => $site->getIsFeatureMap() ? 1 : 0, 'is_feature_tag' => $site->getIsFeatureTag() ? 1 : 0, 'is_feature_virtual_events' => $site->getIsFeatureVirtualEvents() ? 1 : 0, 'is_feature_physical_events' => $site->getIsFeaturePhysicalEvents() ? 1 : 0, 'is_listed_in_index' => $site->getIsListedInIndex() ? 1 : 0, 'is_web_robots_allowed' => $site->getIsWebRobotsAllowed() ? 1 : 0, 'prompt_emails_days_in_advance' => $site->getPromptEmailsDaysInAdvance(), 'site_quota_id' => $siteQuota->getId()));
$data = $stat->fetch();
$site->setId($data['id']);
$stat = $DB->prepare("INSERT INTO site_history (site_id, user_account_id, " . "title, slug, slug_canonical, created_at,is_feature_map,is_feature_importer," . "is_feature_curated_list,is_listed_in_index,is_web_robots_allowed, " . " prompt_emails_days_in_advance, is_new," . "is_feature_tag,is_feature_physical_events,is_feature_virtual_events) " . "VALUES (:site_id, :user_account_id, :title, " . ":slug, :slug_canonical, :created_at,:is_feature_map,:is_feature_importer," . ":is_feature_curated_list,:is_listed_in_index,:is_web_robots_allowed, " . " :prompt_emails_days_in_advance, '1', " . ":is_feature_tag,:is_feature_physical_events,:is_feature_virtual_events)");
$stat->execute(array('site_id' => $site->getId(), 'user_account_id' => $owner->getId(), 'title' => substr($site->getTitle(), 0, VARCHAR_COLUMN_LENGTH_USED), 'slug' => $site->getSlug(), 'slug_canonical' => SiteModel::makeCanonicalSlug($site->getSlug()), 'created_at' => $createdat, 'is_feature_curated_list' => $site->getIsFeatureCuratedList() ? 1 : 0, 'is_feature_importer' => $site->getIsFeatureImporter() ? 1 : 0, 'is_feature_map' => $site->getIsFeatureMap() ? 1 : 0, 'is_feature_tag' => $site->getIsFeatureTag() ? 1 : 0, 'is_feature_virtual_events' => $site->getIsFeatureVirtualEvents() ? 1 : 0, 'is_feature_physical_events' => $site->getIsFeaturePhysicalEvents() ? 1 : 0, 'is_listed_in_index' => $site->getIsListedInIndex() ? 1 : 0, 'is_web_robots_allowed' => $site->getIsWebRobotsAllowed() ? 1 : 0, 'prompt_emails_days_in_advance' => $site->getPromptEmailsDaysInAdvance()));
// Permissions
$ugr = new UserGroupRepository();
$userGroupEditors = new UserGroupModel();
$userGroupEditors->setTitle("Editors");
$userGroupEditors->setIsIncludesVerifiedUsers($canAnyUserVerifiedEdit);
$ugr->createForSite($site, $userGroupEditors, $owner, array(array('org.openacalendar', 'CALENDAR_CHANGE')), array($owner));
$userGroupEditors = new UserGroupModel();
$userGroupEditors->setTitle("Administrators");
$ugr->createForSite($site, $userGroupEditors, $owner, array(array('org.openacalendar', 'CALENDAR_ADMINISTRATE')), array($owner));
// Countries!
$stat = $DB->prepare("INSERT INTO country_in_site_information (site_id,country_id,is_in,is_previously_in,created_at) VALUES (:site_id,:country_id,'1','1',:created_at)");
foreach ($countries as $country) {
$stat->execute(array('country_id' => $country->getId(), 'site_id' => $site->getId(), 'created_at' => $createdat));
}
$stat = $DB->prepare("INSERT INTO user_watches_site_information (user_account_id,site_id,is_watching,is_was_once_watching,last_watch_started,created_at) " . "VALUES (:user_account_id,:site_id,:is_watching,:is_was_once_watching,:last_watch_started,:created_at)");
$stat->execute(array('user_account_id' => $owner->getId(), 'site_id' => $site->getId(), 'is_watching' => '1', 'is_was_once_watching' => '1', 'created_at' => \TimeSource::getFormattedForDataBase(), 'last_watch_started' => \TimeSource::getFormattedForDataBase()));
$DB->commit();
$EXTENSIONHOOKRUNNER->afterSiteCreate($site, $owner);
} catch (Exception $e) {
$DB->rollBack();
}
}
示例2: array
function __construct(\models\SiteModel $siteModel, UserPermissionsList $permissionsList)
{
$this->actions = array('org.openacalendar' => array('eventNew' => $permissionsList->hasPermission("org.openacalendar", "EVENTS_CHANGE"), 'groupNew' => $permissionsList->hasPermission("org.openacalendar", "GROUPS_CHANGE") && $siteModel->getIsFeatureGroup(), 'venueNew' => $permissionsList->hasPermission("org.openacalendar", "VENUES_CHANGE") && $siteModel->getIsFeaturePhysicalEvents(), 'areaNew' => $permissionsList->hasPermission("org.openacalendar", "AREAS_CHANGE") && $siteModel->getIsFeaturePhysicalEvents(), 'curatedListNew' => $permissionsList->hasPermission("org.openacalendar", "CALENDAR_CHANGE") && $siteModel->getIsFeatureCuratedList(), 'curatedListGeneralEdit' => $permissionsList->hasPermission("org.openacalendar", "CALENDAR_CHANGE") && $siteModel->getIsFeatureCuratedList(), 'admin' => $permissionsList->hasPermission("org.openacalendar", "CALENDAR_ADMINISTRATE")));
}
示例3: update
/**
* @param SiteModel $site
* @param $fields
* @param UserAccountModel $user As opposed to other DBAccess classes, User can not be NULL.
* @throws Exception
* @throws \Exception
*/
public function update(SiteModel $site, $fields, UserAccountModel $user)
{
$alreadyInTransaction = $this->db->inTransaction();
// Make Information Data
$fieldsSQL1 = array();
$fieldsParams1 = array('id' => $site->getId());
foreach ($fields as $field) {
$fieldsSQL1[] = " " . $field . "=:" . $field . " ";
if ($field == 'title') {
$fieldsParams1['title'] = substr($site->getTitle(), 0, VARCHAR_COLUMN_LENGTH_USED);
} else {
if ($field == 'slug') {
$fieldsParams1['slug'] = substr($site->getSlug(), 0, VARCHAR_COLUMN_LENGTH_USED);
$fieldsSQL1[] = " slug_canonical=:slug_canonical ";
$fieldsParams1['slug_canonical'] = substr(SiteModel::makeCanonicalSlug($site->getSlug()), 0, VARCHAR_COLUMN_LENGTH_USED);
} else {
if ($field == 'description_text') {
$fieldsParams1['description_text'] = $site->getDescriptionText();
} else {
if ($field == 'footer_text') {
$fieldsParams1['footer_text'] = $site->getFooterText();
} else {
if ($field == 'is_web_robots_allowed') {
$fieldsParams1['is_web_robots_allowed'] = $site->getIsWebRobotsAllowed() ? 1 : 0;
} else {
if ($field == 'is_closed_by_sys_admin') {
$fieldsParams1['is_closed_by_sys_admin'] = $site->getIsClosedBySysAdmin() ? 1 : 0;
} else {
if ($field == 'closed_by_sys_admin_reason') {
$fieldsParams1['closed_by_sys_admin_reason'] = $site->getClosedBySysAdminReason();
} else {
if ($field == 'is_listed_in_index') {
$fieldsParams1['is_listed_in_index'] = $site->getIsListedInIndex() ? 1 : 0;
} else {
if ($field == 'is_feature_importer') {
$fieldsParams1['is_feature_importer'] = $site->getIsFeatureImporter() ? 1 : 0;
} else {
if ($field == 'is_feature_curated_list') {
$fieldsParams1['is_feature_curated_list'] = $site->getIsFeatureCuratedList() ? 1 : 0;
} else {
if ($field == 'is_feature_map') {
$fieldsParams1['is_feature_map'] = $site->getIsFeatureMap() ? 1 : 0;
} else {
if ($field == 'is_feature_virtual_events') {
$fieldsParams1['is_feature_virtual_events'] = $site->getIsFeatureVirtualEvents() ? 1 : 0;
} else {
if ($field == 'is_feature_physical_events') {
$fieldsParams1['is_feature_physical_events'] = $site->getIsFeaturePhysicalEvents() ? 1 : 0;
} else {
if ($field == 'is_feature_group') {
$fieldsParams1['is_feature_group'] = $site->getIsFeatureGroup() ? 1 : 0;
} else {
if ($field == 'prompt_emails_days_in_advance') {
$fieldsParams1['prompt_emails_days_in_advance'] = $site->getPromptEmailsDaysInAdvance();
} else {
if ($field == 'is_feature_tag') {
$fieldsParams1['is_feature_tag'] = $site->getIsFeatureTag() ? 1 : 0;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
// Make History Data
$fieldsSQL2 = array('site_id', 'user_account_id', 'created_at');
$fieldsSQLParams2 = array(':site_id', ':user_account_id', ':created_at');
$fieldsParams2 = array('site_id' => $site->getId(), 'user_account_id' => $user ? $user->getId() : null, 'created_at' => $this->timesource->getFormattedForDataBase());
foreach ($this->possibleFields as $field) {
if (in_array($field, $fields) || $field == 'title') {
$fieldsSQL2[] = " " . $field . " ";
$fieldsSQLParams2[] = " :" . $field . " ";
if ($field == 'title') {
$fieldsParams2['title'] = substr($site->getTitle(), 0, VARCHAR_COLUMN_LENGTH_USED);
} else {
if ($field == 'slug') {
$fieldsParams2['slug'] = substr($site->getSlug(), 0, VARCHAR_COLUMN_LENGTH_USED);
$fieldsSQL2[] = " slug_canonical ";
$fieldsSQLParams2[] = " :slug_canonical ";
$fieldsParams2['slug_canonical'] = substr(SiteModel::makeCanonicalSlug($site->getSlug()), 0, VARCHAR_COLUMN_LENGTH_USED);
} else {
if ($field == 'description_text') {
$fieldsParams2['description_text'] = $site->getDescriptionText();
//.........這裏部分代碼省略.........