function show() { $myModel = new MyModel(); $data = $myModel->get(); $myView = new MyView(); $myView->display($data); }
public function testGetterAndSetterFilters() { $date = new \DateTime('1980-10-05'); $obj = new MyModel(['username' => 'Matt', 'subscription_date' => $date]); $this->assertInstanceOf('DateTime', $obj->subscription_date, 'Property "subscription_date" should be a DateTime object.'); $this->assertInternalType('string', $obj->getRawProperty('subscription_date'), 'Raw Property "subscription_date" should be a string.'); if (!getenv('CI')) { $obj->save(); $this->assertNotEmpty($obj->user_id, 'Property id should not be empty.'); } }
function __construct() { parent::__construct(); Configure::write('Community.profileUrl', $this->profileUrl); if (file_exists(PATH_ROOT . 'components' . _DS . 'com_community' . _DS . 'community.php')) { $this->community = true; $Menu = ClassRegistry::getClass('MenuModel'); $this->menu_id = $Menu->getComponentMenuId('com_community&view=frontpage'); if (!$this->menu_id) { $this->menu_id = $Menu->getComponentMenuId('com_community&view=profile'); } if (!$this->menu_id) { $this->menu_id = $Menu->getComponentMenuId('com_community'); } // For JomSocial <= 2.1 if (!file_exists(PATH_ROOT . 'components/com_community/assets/user_thumb.png')) { $this->default_thumb = 'components/com_community/assets/default_thumb.jpg'; } $cache_key = 'jomsocial_config_' . md5(cmsFramework::getConfig('secret')); $JSConfig = S2Cache::read($cache_key); if (false == $JSConfig) { // Read the JomSocial configuration to determine the storage location for avatars $JSConfig = json_decode($this->query("SELECT params FROM #__community_config WHERE name = 'config'", 'loadResult'), true); $JSConfigForJReviews = array('user_avatar_storage' => $JSConfig['user_avatar_storage'], 'storages3bucket' => $JSConfig['storages3bucket']); S2Cache::write($cache_key, $JSConfigForJReviews); } $this->avatar_storage = $JSConfig['user_avatar_storage']; $this->s3_bucket = $JSConfig['storages3bucket']; Configure::write('Community.register_url', sprintf($this->registerUrl, $this->menu_id)); } }
function __construct() { parent::__construct(); $cms_version = getCmsVersion(); switch ($this->integrationMode) { case 'groups': $this->fields['Category.title'] = 'Category.title AS `Category.title`'; $this->joins = array('Total' => "LEFT JOIN #__jreviews_listing_totals AS Totals ON Totals.listing_id = Listing.id AND Totals.extension = 'com_comprofiler'", 'CategoryMap' => "LEFT JOIN #__user_usergroup_map AS CategoryMap ON Listing.id = CategoryMap.user_id", 'JreviewsCategory' => "INNER JOIN #__jreviews_categories AS JreviewsCategory ON CategoryMap.group_id = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'Category' => "LEFT JOIN #__usergroups AS Category ON CategoryMap.group_id = Category.{$this->categoryPrimaryKey}", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id', 'LEFT JOIN #__comprofiler AS CommunityBuilder ON Listing.id = CommunityBuilder.id', "LEFT JOIN #__users AS User ON User.id = Listing.id"); $this->group[] = 'Listing.id'; $this->joinsReviews = array("LEFT JOIN #__users AS Listing ON Review.pid = Listing.id", 'CategoryMap' => "LEFT JOIN #__user_usergroup_map AS CategoryMap ON Listing.id = CategoryMap.user_id", 'JreviewsCategory' => "INNER JOIN #__jreviews_categories AS JreviewsCategory ON CategoryMap.group_id = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'Category' => "LEFT JOIN #__usergroups AS Category ON CategoryMap.group_id = Category.{$this->categoryPrimaryKey}", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id'); if ($cms_version == CMS_JOOMLA15) { unset($this->group); $this->fields['Category.title'] = 'Category.name AS `Category.title`'; $this->joins = array('Total' => "LEFT JOIN #__jreviews_listing_totals AS Totals ON Totals.listing_id = Listing.id AND Totals.extension = 'com_comprofiler'", 'Category' => "LEFT JOIN #__core_acl_aro_groups AS Category ON Listing.gid = Category.{$this->categoryPrimaryKey}", 'JreviewsCategory' => "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.gid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id', 'LEFT JOIN #__comprofiler AS CommunityBuilder ON Listing.id = CommunityBuilder.id', "LEFT JOIN #__users AS User ON User.id = Listing.id"); $this->joinsReviews = array("LEFT JOIN #__users AS Listing ON Review.pid = Listing.id", "LEFT JOIN #__core_acl_aro_groups AS Category ON Listing.gid = Category.{$this->categoryPrimaryKey}", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.gid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id'); } break; case 'fields': $this->fields = array('Listing.id AS `Listing.listing_id`', 'Listing.title' => 'Listing.username AS `Listing.title`', 'CommunityBuilder.avatar AS `Listing.images`', 'CommunityBuilder.avatarapproved AS `Listing.images_approved`', "'com_comprofiler' AS `Listing.extension`", 'JreviewsCategory.id AS `Listing.cat_id`', 'Category.fieldtitle AS `Category.title`', 'JreviewsCategory.id AS `Category.cat_id`', 'Criteria.id AS `Criteria.criteria_id`', 'Criteria.criteria AS `Criteria.criteria`', 'Criteria.tooltips AS `Criteria.tooltips`', 'Criteria.weights AS `Criteria.weights`', 'Criteria.required AS `Criteria.required`', 'Criteria.state AS `Criteria.state`'); $this->joins = array('INNER JOIN #__comprofiler AS CommunityBuilder ON Listing.id = CommunityBuilder.id', "LEFT JOIN #__comprofiler_field_values AS Category ON CommunityBuilder.{$this->cbCustomField} = Category.fieldtitle", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Category.fieldvalueid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id'); $this->joinsReviews = array('INNER JOIN #__comprofiler AS CommunityBuilder ON Review.pid = CommunityBuilder.id', "LEFT JOIN #__comprofiler_field_values AS Category ON CommunityBuilder.{$this->cbCustomField} = Category.fieldtitle", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Category.fieldvalueid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id'); break; } $this->tag = __t("COMMUNITY_BUILDER_TAG", true); // Used in MyReviews page to differentiate from other component reviews $this->fields[] = "'{$this->tag}' AS `Listing.tag`"; # Use name or username based on JReviews config $Config = Configure::read('JreviewsSystem.Config'); if ($Config->name_choice == 'realname') { $this->fields['Listing.title'] = 'Listing.name AS `Listing.title`'; } unset($Config); }
function __construct() { parent::__construct(); $this->tag = __t("K2_TAG", true); // Used in MyReviews page to differentiate from other component reviews // $this->fields[] = "'{$this->tag }' AS `Listing.tag`"; }
function __construct() { parent::__construct(); switch ($this->integrationMode) { case 'groups': // The primary key for categories switch (getCmsVersion()) { case CMS_JOOMLA10: case CMS_MAMBO46: $this->categoryPrimaryKey = 'group_id'; break; case CMS_JOOMLA15: $this->categoryPrimaryKey = 'id'; break; } $this->joins = array('Total' => "LEFT JOIN #__jreviews_listing_totals AS Totals ON Totals.listing_id = Listing.id AND Totals.extension = 'com_comprofiler'", "LEFT JOIN #__core_acl_aro_groups AS Category ON Listing.gid = Category.{$this->categoryPrimaryKey}", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.gid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id', 'LEFT JOIN #__comprofiler AS CommunityBuilder ON Listing.id = CommunityBuilder.id', "LEFT JOIN #__users AS User ON User.id = Listing.id"); $this->joinsReviews = array("LEFT JOIN #__users AS Listing ON Review.pid = Listing.id", "LEFT JOIN #__core_acl_aro_groups AS Category ON Listing.gid = Category.{$this->categoryPrimaryKey}", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.gid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id'); break; case 'fields': $this->fields = array('Listing.id AS `Listing.listing_id`', 'Listing.username AS `Listing.title`', 'CommunityBuilder.avatar AS `Listing.images`', 'CommunityBuilder.avatarapproved AS `Listing.images_approved`', "'com_comprofiler' AS `Listing.extension`", 'JreviewsCategory.id AS `Listing.cat_id`', 'Category.fieldtitle AS `Category.title`', 'JreviewsCategory.id AS `Category.cat_id`', 'Criteria.id AS `Criteria.criteria_id`', 'Criteria.criteria AS `Criteria.criteria`', 'Criteria.tooltips AS `Criteria.tooltips`', 'Criteria.weights AS `Criteria.weights`', 'Criteria.required AS `Criteria.required`', 'Criteria.state AS `Criteria.state`'); $this->joins = array('INNER JOIN #__comprofiler AS CommunityBuilder ON Listing.id = CommunityBuilder.id', "LEFT JOIN #__comprofiler_field_values AS Category ON CommunityBuilder.{$this->cbCustomField} = Category.fieldtitle", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Category.fieldvalueid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id'); $this->joinsReviews = array('INNER JOIN #__comprofiler AS CommunityBuilder ON Review.pid = CommunityBuilder.id', "LEFT JOIN #__comprofiler_field_values AS Category ON CommunityBuilder.{$this->cbCustomField} = Category.fieldtitle", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Category.fieldvalueid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id'); break; } $this->tag = __t("COMMUNITY_BUILDER_TAG", true); // Used in MyReviews page to differentiate from other component reviews $this->fields[] = "'{$this->tag}' AS `Listing.tag`"; }
function __construct() { parent::__construct(); if ($this->cmsVersion == CMS_JOOMLA15) { $this->fields = array('Category.id AS `Category.cat_id`', 'Category.section AS `Category.section_id`', 'Category.title AS `Category.title`', 'Category.alias AS `Category.slug`', 'Category.image AS `Category.image`', 'Category.image_position AS `Category.image_position`', 'Category.description AS `Category.description`', 'Category.access AS `Category.access`', 'Category.published AS `Category.published`', 'Directory.id AS `Category.dir_id`', 'JreviewsCategory.criteriaid AS `Category.criteria_id`', 'JreviewsCategory.tmpl AS `Category.tmpl`', 'JreviewsCategory.tmpl_suffix AS `Category.tmpl_suffix`', 'Directory.id AS `Directory.dir_id`', 'Directory.desc AS `Directory.title`', 'Directory.title AS `Directory.slug`', 'ListingType.config AS `ListingType.config`'); } }
function __construct() { parent::__construct(); $this->tag = __t("SOBI2_TAG", true); // Used in MyReviews page to differentiate from other component reviews $this->fields[] = "'{$this->tag}' AS `Listing.tag`"; // Comment this line to hide the tag from the output }
function __construct() { parent::__construct(); // Used in MyReviews page to differentiate from other component reviews $this->tag = __t("EZREALTY_PROFILE_TAG", true); // Uncomment line below to show tag in My Reviews page // $this->fields[] = "'{$this->tag }' AS `Listing.tag`"; }
function __construct() { parent::__construct(); $this->joins = array('INNER JOIN #__comprofiler AS CommunityBuilder ON Listing.id = CommunityBuilder.id', "LEFT JOIN #__comprofiler_field_values AS Category ON CommunityBuilder.{$this->customField} = Category.fieldtitle", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Category.fieldvalueid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id'); $this->joinsReviews = array('INNER JOIN #__comprofiler AS CommunityBuilder ON Review.pid = CommunityBuilder.id', "LEFT JOIN #__comprofiler_field_values AS Category ON CommunityBuilder.{$this->customField} = Category.fieldtitle", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Category.fieldvalueid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id'); $this->tag = __t("COMMUNITY_BUILDER_TAG", true); // Used in MyReviews page to differentiate from other component reviews $this->fields[] = "'{$this->tag}' AS `Listing.tag`"; }
function __construct() { parent::__construct(); // Used in MyReviews page to differentiate from other component reviews $this->tag = __t("MYBLOG_TAG", true); // Uncomment line below to show tag in My Reviews page $this->fields[] = "'{$this->tag}' AS `Listing.tag`"; // Set default WHERE statement $this->conditions = array('Listing.state = 1', '( Listing.publish_up = "' . NULL_DATE . '" OR Listing.publish_up <= "' . _CURRENT_SERVER_TIME . '" )', '( Listing.publish_down = "' . NULL_DATE . '" OR Listing.publish_down >= "' . _CURRENT_SERVER_TIME . '" )', 'Listing.access <= ' . $this->_user->gid, 'Listing.catid > 0'); }
function __construct() { parent::__construct(); Configure::write('Community.profileUrl', $this->profileUrl); if (file_exists(PATH_ROOT . 'components' . _DS . 'com_kunena' . _DS . 'kunena.php')) { $this->community = true; $Menu = registerClass::getInstance('MenuModel'); $this->menu_id = $Menu->getComponentMenuId('com_kunena'); } }
protected function initializeModel() { if (self::$shouldCallParentAndEcho) { parent::initializeModel(); echo 'Model' . PHP_EOL; } if (is_null($this->model)) { $this->model = MyModel::getInstance(); } }
function __construct() { parent::__construct(); /* if(getCmsVersion() == CMS_JOOMLA15) { // Add listing, category aliases to fields $this->fields[] = 'CASE WHEN CHAR_LENGTH(Section.alias) THEN Section.alias ELSE Section.title END AS `Section.slug`'; } else { $this->fields[] = 'Section.name AS `Section.slug`'; } */ }
public function save() { foreach ($this->items as $index => $data) { //if exists, update if ($data["object"]) { $data["object"]->update(array('description' => $data["description"], 'producttype_id' => $data["producttype"]->getId(), 'category1' => $data["category1"], 'category2' => $data["category2"], 'category3' => $data["category3"], 'category4' => $data["category4"], 'category5' => $data["category5"], 'category6' => $data["category6"], 'category7' => $data["category7"], 'category8' => $data["category8"], 'category9' => $data["category9"], 'category10' => $data["category10"])); } else { $data["object"] = MyModel::create("Product", array('name' => $data["name"], 'description' => $data["description"], 'producttype_id' => $this->main->producttypedata->items[$data["producttypename"]]["object"]->getId(), 'category1' => $data["category1"], 'category2' => $data["category2"], 'category3' => $data["category3"], 'category4' => $data["category4"], 'category5' => $data["category5"], 'category6' => $data["category6"], 'category7' => $data["category7"], 'category8' => $data["category8"], 'category9' => $data["category9"], 'category10' => $data["category10"])); } } }
function __construct() { parent::__construct(); Configure::write('Community.profileUrl', $this->profileUrl); if (file_exists(PATH_ROOT . 'components' . _DS . 'com_comprofiler' . _DS . 'comprofiler.php')) { $this->community = true; $Menu = ClassRegistry::getClass('MenuModel'); $this->menu_id = $Menu->getComponentMenuId('com_comprofiler', true); // 2nd parameter forces a LIKE '%com_comprofiler' query to find only the profile menu Configure::write('Community.register_url', sprintf($this->registerUrl, $this->menu_id)); } }
function __construct() { parent::__construct(); Configure::write('Community.profileUrl', $this->profileUrl); if (file_exists(PATH_ROOT . 'components' . _DS . 'com_socialengine' . _DS . 'socialengine.php')) { $this->community = true; $Menu = registerClass::getInstance('MenuModel'); $this->menu_id = $Menu->getComponentMenuId('index.php?option=com_socialengine&view=person'); if (!$this->menu_id) { $this->menu_id = $Menu->getComponentMenuId('com_socialengine'); } } }
function __construct() { parent::__construct(); Configure::write('Community.profileUrl', $this->profileUrl); if (file_exists(PATH_ROOT . 'components' . _DS . 'com_community' . _DS . 'community.php')) { $this->community = true; $Menu = registerClass::getInstance('MenuModel'); $this->menu_id = $Menu->getComponentMenuId('com_community&view=profile'); if (!$this->menu_id) { $this->menu_id = $Menu->getComponentMenuId('com_community'); } Configure::write('Community.register_url', sprintf($this->registerUrl, $this->menu_id)); } }
function __construct() { parent::__construct(); // The primary key for categories switch (getCmsVersion()) { case CMS_JOOMLA10: case CMS_MAMBO46: $this->categoryPrimaryKey = 'group_id'; break; case CMS_JOOMLA15: $this->categoryPrimaryKey = 'id'; break; } $this->joins = array('Total' => "LEFT JOIN #__jreviews_listing_totals AS Totals ON Totals.listing_id = Listing.id AND Totals.extension = '{$this->extension_alias}'", "LEFT JOIN #__core_acl_aro_groups AS Category ON Listing.gid = Category.{$this->categoryPrimaryKey}", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.gid = JreviewsCategory.id AND JreviewsCategory.`option` = '{$this->extension_alias}'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id', 'LEFT JOIN #__community_users AS Community ON Listing.id = Community.userid', "LEFT JOIN #__users AS User ON User.id = Listing.id"); $this->joinsReviews = array("LEFT JOIN #__users AS Listing ON Review.pid = Listing.id", "LEFT JOIN #__core_acl_aro_groups AS Category ON Listing.gid = Category.{$this->categoryPrimaryKey}", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.gid = JreviewsCategory.id AND JreviewsCategory.`option` = '{$this->extension_alias}'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id'); $this->tag = __t("JOMSOCIAL_TAG", true); // Used in MyReviews page to differentiate from other component reviews $this->fields[] = "'{$this->tag}' AS `Listing.tag`"; }
function __construct() { parent::__construct(); $User =& cmsFramework::getUser(); // Used in MyReviews page to differentiate from other component reviews $this->tag = __t("MYBLOG_TAG", true); // Uncomment line below to show tag in My Reviews page $this->fields[] = "'{$this->tag}' AS `Listing.tag`"; // Set default WHERE statement $this->conditions = array('Listing.state = 1', '( Listing.publish_up = "' . NULL_DATE . '" OR Listing.publish_up <= "' . _CURRENT_SERVER_TIME . '" )', '( Listing.publish_down = "' . NULL_DATE . '" OR Listing.publish_down >= "' . _CURRENT_SERVER_TIME . '" )', 'Listing.catid > 0'); if (!defined('MVC_FRAMEWORK_ADMIN')) { # Shows only links users can access $Access = Configure::read('JreviewsSystem.Access'); if ($this->cmsVersion == CMS_JOOMLA15) { $this->conditions[] = 'Listing.access <= ' . $User->gid; } else { $this->conditions[] = 'Listing.access IN ( ' . $Access->getAccessLevels() . ')'; } } }
function __construct() { parent::__construct(); Configure::write('Community.profileUrl', $this->profileUrl); if (file_exists(PATH_ROOT . 'components' . _DS . 'com_community' . _DS . 'community.php')) { $this->community = true; $Menu = ClassRegistry::getClass('MenuModel'); $this->menu_id = $Menu->getComponentMenuId('com_community&view=frontpage'); if (!$this->menu_id) { $this->menu_id = $Menu->getComponentMenuId('com_community&view=profile'); } if (!$this->menu_id) { $this->menu_id = $Menu->getComponentMenuId('com_community'); } // For JomSocial <= 2.1 if (!file_exists(PATH_ROOT . 'components/com_community/assets/user_thumb.png')) { $this->default_thumb = 'components/com_community/assets/default_thumb.jpg'; } Configure::write('Community.register_url', sprintf($this->registerUrl, $this->menu_id)); } }
function __construct() { parent::__construct(); $this->tag = __t("Listing", true); // Used in MyReviews page to differentiate from other component reviews // Uncomment line below to show tag in My Reviews page // $this->fields[] = "'{$this->tag }' AS `Listing.tag`"; if (getCmsVersion() == CMS_JOOMLA15) { // Add listing, category aliases to fields $this->fields[] = 'Listing.alias AS `Listing.slug`'; $this->fields[] = 'Category.alias AS `Category.slug`'; $this->fields[] = 'Section.alias AS `Section.slug`'; } else { $this->fields[] = 'Listing.title_alias AS `Listing.slug`'; $this->fields[] = 'Category.name AS `Category.slug`'; $this->fields[] = 'Section.name AS `Section.slug`'; } // PaidListings integration - when completing review info needs to be triggered here if (class_exists('PaidListingsComponent')) { PaidListingsComponent::applyBeforeFindListingChanges($this); } $this->Routes = RegisterClass::getInstance('RoutesHelper'); }
function __construct() { if (getCmsVersion() == CMS_JOOMLA15) { $this->fields[] = 'Listing.sectionid AS `Listing.section_id`'; $this->fields[] = 'Section.id AS `Section.section_id`'; $this->fields[] = 'Section.title AS `Section.title`'; $this->fields[] = 'Section.alias AS `Section.slug`'; $this->fields[] = 'Category.image AS `Listing.category_image`'; unset($this->fields['cat_params'], $this->joins['ParentCategory']); } else { unset($this->joins['Section']); } parent::__construct(); $this->tag = __t("Listing", true); // Used in MyReviews page to differentiate from other component reviews // Uncomment line below to show tag in My Reviews page // $this->fields[] = "'{$this->tag }' AS `Listing.tag`"; // PaidListings integration - when completing review info needs to be triggered here if (class_exists('PaidListingsComponent')) { PaidListingsComponent::applyBeforeFindListingChanges($this); } $this->Routes = ClassRegistry::getClass('RoutesHelper'); }
function __construct() { parent::__construct(); $this->groups_table = $this->cmsVersion == CMS_JOOMLA15 ? '#__core_acl_aro_groups' : '#__usergroups'; $this->groups_title_col = $this->cmsVersion == CMS_JOOMLA15 ? 'name' : 'title'; $this->fields['cat_name'] = "Category.{$this->groups_title_col} AS `Category.title`"; if ($this->cmsVersion == CMS_JOOMLA15) { $this->joins = array('Total' => "LEFT JOIN #__jreviews_listing_totals AS Totals ON Totals.listing_id = Listing.id AND Totals.extension = '{$this->extension_alias}'", "LEFT JOIN {$this->groups_table} AS Category ON Listing.gid = Category.{$this->categoryPrimaryKey}", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.gid = JreviewsCategory.id AND JreviewsCategory.`option` = '{$this->extension_alias}'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id', 'LEFT JOIN #__community_users AS Community ON Listing.id = Community.userid', "LEFT JOIN #__users AS User ON User.id = Listing.id"); $this->joinsReviews = array("LEFT JOIN #__users AS Listing ON Review.pid = Listing.id", "LEFT JOIN {$this->groups_table} AS Category ON Listing.gid = Category.{$this->categoryPrimaryKey}", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.gid = JreviewsCategory.id AND JreviewsCategory.`option` = '{$this->extension_alias}'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id'); } else { $this->joins = array('Total' => "LEFT JOIN #__jreviews_listing_totals AS Totals ON Totals.listing_id = Listing.id AND Totals.extension = '{$this->extension_alias}'", "INNER JOIN #__user_usergroup_map AS UserGroupMap ON UserGroupMap.user_id = Listing.id", "LEFT JOIN {$this->groups_table} AS Category ON UserGroupMap.group_id = Category.{$this->categoryPrimaryKey}", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Category.{$this->categoryPrimaryKey} = JreviewsCategory.id AND JreviewsCategory.`option` = '{$this->extension_alias}'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id', 'LEFT JOIN #__community_users AS Community ON Listing.id = Community.userid', "LEFT JOIN #__users AS User ON User.id = Listing.id"); $this->joinsReviews = array("LEFT JOIN #__users AS Listing ON Review.pid = Listing.id", "INNER JOIN #__user_usergroup_map AS UserGroupMap ON UserGroupMap.user_id = Listing.id", "LEFT JOIN {$this->groups_table} AS Category ON UserGroupMap.group_id = Category.{$this->categoryPrimaryKey}", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Category.{$this->categoryPrimaryKey} = JreviewsCategory.id AND JreviewsCategory.`option` = '{$this->extension_alias}'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id'); } $this->group[] = "Listing.id"; $this->tag = __t("JOMSOCIAL_TAG", true); // Used in MyReviews page to differentiate from other component reviews $this->fields[] = "'{$this->tag}' AS `Listing.tag`"; # Use name or username based on JReviews config $Config = Configure::read('JreviewsSystem.Config'); if ($Config->name_choice == 'realname') { $this->fields['Listing.title'] = 'Listing.name AS `Listing.title`'; } unset($Config); }
<?php /*include_once("myconfig.php");*/ include '.././classes/mymodel.php'; include '.././classes/myview.php'; /*CONTROLLER CREATES THE MODEL*/ $theActualModel = new MyModel(); /*TEST IT IS INSTANCIATED*/ $myTemp = $theActualModel->getQueryValue(); echo $myTemp; echo "<p></p>"; /*CONTROLLER FINDS OUT THE QUERY STRING APPENDED TO THE URL, REVERSES IT, AND SENDS IT TO THE MODEL*/ /*... BUT MAYBE IT WOULD BE BETTER FOR THE MANIPULATION TO OCCUR INSIDE THE MODEL?*/ $theURLStuff = strrev($_SERVER['QUERY_STRING']); $theActualModel->setQueryValue($theURLStuff); /*CONTROLLER CREATES THE VIEW*/ $theActualView = new MyView(); /*TEST THE VIEW WORKS*/ $myTempViewModelText = $theActualView->displayTheInfo(); /*echo $myTempViewModelText ; */ echo "<p>Here is the number at the end of the URL, but reversed.</p>"; /*CONTROLLER GETS TEXT FROM THE MODEL AND SENDS TO THE VIEW*/ $theActualView->setInfoToDisplay($theActualModel->getQueryValue()); /*CONTROLLER TELLS VIEW TO DISPLAY THE TEXT*/ $theActualView->displayTheInfo();
public function save() { //if exists, update if ($this->pricelist) { $this->pricelist->update(array('vendor_id' => $this->vendor->getId(), 'date' => $this->date)); } else { $this->pricelist = MyModel::create("Pricelist", array('name' => $this->pricelistname, 'vendor_id' => $this->vendor->getId(), 'date' => $this->date)); } }
/** * @test */ public function foreachOverCollection() { $model1 = new MyModel(); $model1->setId(1); $this->collection->add($model1); $model2 = new MyModel(); $model2->setId(2); $this->collection->add($model2); $model3 = new MyModel(); $model3->setId(3); $this->collection->add($model3); $i = 0; foreach ($this->collection as $model) { /** @var $model MyModel */ $this->assertSame(spl_object_hash($model), $this->collection->key()); $this->assertTrue(in_array($model->getId(), [1, 2, 3])); $i++; } $this->assertSame(3, $i); }
function __construct() { parent::__construct(); }
<?php require_once '../framework/core.php'; $x = new MyModel(); $x->load(1); $x['name'] = 'Foobar, Inc.'; $dump = $x->dump(); //$x->save(); render('example');
public function executeSetstatus(sfWebRequest $request) { $producttype = MyModel::fetchOne("Producttype", array('id' => $request->getParameter("id"))); $producttype->setStatus($request->getParameter("color")); $producttype->save(); $this->redirect($request->getReferer()); }