Example #1
0
 public static function loadPageDefault()
 {
     $langId = Context::getContext()->language->id;
     $shopId = Context::getContext()->shop->id;
     $groupID = intval($_POST['groupID']);
     $type = $_POST['type'];
     $itemId = intval($_POST['itemId']);
     $page = intval($_POST['page']);
     $itemWidth = intval($_POST['itemWidth']);
     $itemHeight = round($_POST['itemHeight'], 3);
     $css = 'width: ' . $itemWidth . 'px; height:' . $itemHeight . "px;";
     $group = DB::getInstance()->getRow("Select * From " . _DB_PREFIX_ . "groupcategory_groups Where id = " . $groupID);
     $response = '';
     $products = array();
     if ($group) {
         $module = new GroupCategory();
         $itemConfig = json_decode($group['itemConfig']);
         if (!$itemConfig->countItem || (int) $itemConfig->countItem <= 0) {
             $pageSize = 3;
         } else {
             $pageSize = $itemConfig->countItem;
         }
         $offset = $page * $pageSize;
         if ($itemId == 0) {
             $arrSubCategory = GroupCategoryLibraries::getCategoryIds($group['categoryId']);
             $arrSubCategory[] = $group['categoryId'];
             if ($type == 'saller') {
                 $products = GroupCategoryLibraries::getProducts_Sales($langId, $arrSubCategory, null, false, $pageSize, $offset);
             } elseif ($type == 'view') {
                 $products = GroupCategoryLibraries::getProducts_View($langId, $arrSubCategory, null, false, $pageSize, $offset);
             } elseif ($type == 'special') {
                 $products = GroupCategoryLibraries::getProducts_Special($langId, $arrSubCategory, null, false, $pageSize, $offset);
             } elseif ($type == 'arrival') {
                 $products = GroupCategoryLibraries::getProducts_AddDate($langId, $arrSubCategory, null, false, $pageSize, $offset);
             } else {
                 if ($group['type_default'] == 'saller') {
                     $products = GroupCategoryLibraries::getProducts_Sales($langId, $arrSubCategory, null, false, $pageSize, $offset);
                 } elseif ($group['type_default'] == 'view') {
                     $products = GroupCategoryLibraries::getProducts_View($langId, $arrSubCategory, null, false, $pageSize, $offset);
                 } elseif ($group['type_default'] == 'special') {
                     $products = GroupCategoryLibraries::getProducts_Special($langId, $arrSubCategory, null, false, $pageSize, $offset);
                 } else {
                     $products = GroupCategoryLibraries::getProducts_AddDate($langId, $arrSubCategory, null, false, $pageSize, $offset);
                 }
             }
         } else {
             $item = DB::getInstance()->getRow("Select * From " . _DB_PREFIX_ . "groupcategory_items Where id = " . $itemId);
             if ($item) {
                 $arrSubCategory = GroupCategoryLibraries::getCategoryIds($item['categoryId']);
                 $arrSubCategory[] = $item['categoryId'];
                 $products = GroupCategoryLibraries::getProducts_AddDate($langId, $arrSubCategory, null, false, $pageSize, $offset);
             }
         }
         if ($products) {
             $response = $module->generationHtml_default($products, $css);
         }
     }
     die(Tools::jsonEncode($response));
 }
Example #2
0
 public function btnSave_Click($strFormId, $strControlId, $strParameter)
 {
     //Create New Group from information stored in mctGroup
     $objCloneGroup = new Group();
     // Update any fields for controls that have been created
     if ($this->mctGroup->GroupTypeIdControl) {
         $objCloneGroup->GroupTypeId = $this->mctGroup->GroupTypeIdControl->SelectedValue;
     }
     if ($this->mctGroup->MinistryIdControl) {
         $objCloneGroup->MinistryId = $this->mctGroup->MinistryIdControl->SelectedValue;
     }
     if ($this->mctGroup->NameControl) {
         $objCloneGroup->Name = $this->mctGroup->NameControl->Text;
     }
     if ($this->mctGroup->DescriptionControl) {
         $objCloneGroup->Description = $this->mctGroup->DescriptionControl->Text;
     }
     if ($this->mctGroup->ParentGroupIdControl) {
         $objCloneGroup->ParentGroupId = $this->mctGroup->ParentGroupIdControl->SelectedValue;
     }
     if ($this->mctGroup->HierarchyLevelControl) {
         $objCloneGroup->HierarchyLevel = $this->mctGroup->HierarchyLevelControl->Text;
     }
     if ($this->mctGroup->HierarchyOrderNumberControl) {
         $objCloneGroup->HierarchyOrderNumber = $this->mctGroup->HierarchyOrderNumberControl->Text;
     }
     if ($this->mctGroup->ConfidentialFlagControl) {
         $objCloneGroup->ConfidentialFlag = $this->mctGroup->ConfidentialFlagControl->Checked;
     }
     if ($this->mctGroup->EmailBroadcastTypeIdControl) {
         $objCloneGroup->EmailBroadcastTypeId = $this->mctGroup->EmailBroadcastTypeIdControl->SelectedValue;
     }
     if ($this->mctGroup->TokenControl) {
         $objCloneGroup->Token = $this->mctGroup->TokenControl->Text;
     }
     if ($this->mctGroup->ActiveFlagControl) {
         $objCloneGroup->ActiveFlag = $this->mctGroup->ActiveFlagControl->Checked;
     }
     // Update any UniqueReverseReferences (if any) for controls that have been created for it
     if ($this->mctGroup->GroupCategoryControl) {
         $objCloneGroup->GroupCategory = GroupCategory::Load($this->mctGroup->GroupCategoryControl->SelectedValue);
     }
     if ($this->mctGroup->GrowthGroupControl) {
         $objCloneGroup->GrowthGroup = GrowthGroup::Load($this->mctGroup->GrowthGroupControl->SelectedValue);
     }
     if ($this->mctGroup->SmartGroupControl) {
         $objCloneGroup->SmartGroup = SmartGroup::Load($this->mctGroup->SmartGroupControl->SelectedValue);
     }
     // Save the Cloned Group object
     $objCloneGroup->Save();
     // Get Participation List and propogate it
     $objGroupParticipationArray = $this->mctGroup->Group->GetActiveGroupParticipationArray();
     foreach ($objGroupParticipationArray as $objGroupParticipation) {
         $objCloneGroup->AddPerson(Person::Load($objGroupParticipation->PersonId), $objGroupParticipation->GroupRoleId);
     }
     Group::RefreshHierarchyDataForMinistry($objCloneGroup->MinistryId);
     $this->objForm->pnlGroups_Refresh();
     // Go to new Group.
     $this->ReturnTo('#' . $objCloneGroup->Id);
 }
Example #3
0
 public function run()
 {
     //DB::table('categories')->delete();
     $group_categories = array('g_ent2', 'g_life2', 'g_politics', 'g_tech', 'g_culture2', 'g_other', 'g_r18', 'g_creation', 'g_fanart', 'g_popular', 'g_adult');
     foreach ($group_categories as $group_category) {
         GroupCategory::create(array('content' => $group_category));
     }
 }
Example #4
0
	$searchType = 'group';
	$searchKeyword = func::decode($accessInfo['action']);
	if(!empty($accessInfo['value'])) $searchExtraValue = $accessInfo['value'];

	include ROOT . '/lib/begin.php';

	// 글 목록

	$customQuery = $event->on('Query.feedItems', '');

	$pageCount = $skinConfig->postList; // 페이지갯수
	list($posts, $totalFeedItems) = FeedItem::getFeedItems($searchType, $searchKeyword, $searchExtraValue, $page, $pageCount, false, 0, $customQuery);
	$paging = Func::makePaging($page, $pageCount, $totalFeedItems);
	
	$group = Group::getByName($searchKeyword);
	$groupCategories = GroupCategory::getList($group['id']);
	
	if(count($groupCategories)>0) {
		$src_group = $skin->cutSkinTag('group_category');
		$groups = Group::getList();
		if(count($groups) > 0) {
			$sp_group = "<ul>\n";
				foreach($groupCategories as $groupCategory) {
					$sp_group .= "<li><a href=\"{$servicePath}/group/".func::encode($group['name'])."/".func::encode($groupCategory['name'])."\">{$groupCategory['name']}</a>\n";
				}
			$sp_group .= "</ul>\n";

			$s_group = $skin->parseTag('group_category_list',$sp_group, $src_group);
		} else {
			$s_group = '';
		}
Example #5
0
    $objStructure = new GrowthGroupStructure();
    $objStructure->Name = $objRow['name'];
    $objStructure->Save();
}
$objResult = $objMySqli->Query('SELECT * FROM growth_group_location order by id;');
$objParentGroupArray = array();
while ($objRow = $objResult->fetch_array()) {
    $objGrowthGroupLocation = new GrowthGroupLocation();
    $objGrowthGroupLocation->Location = $objRow['location'];
    $objGrowthGroupLocation->Longitude = $objRow['longitude'];
    $objGrowthGroupLocation->Latitude = $objRow['latitude'];
    $objGrowthGroupLocation->Zoom = $objRow['zoom'];
    $objGrowthGroupLocation->Save();
    $strTokens = explode('(', $objGrowthGroupLocation->Location);
    $objParentGroup = Group::CreateGroupForMinistry($objMinistry, GroupType::GroupCategory, trim($strTokens[0]), 'Growth Groups in ' . $objGrowthGroupLocation->Location);
    $objGroupCategory = new GroupCategory();
    $objGroupCategory->Group = $objParentGroup;
    $objGroupCategory->Save();
    $objGgResult = $objMySqli->Query('SELECT * FROM growth_group WHERE growth_group_location_id=' . $objRow['id'] . ' ORDER BY id');
    while ($objGgRow = $objGgResult->fetch_array()) {
        $objGroup = Group::CreateGroupForMinistry($objMinistry, GroupType::GrowthGroup, $objGgRow['name'], 'Growth Group for ' . $objGgRow['name'], $objParentGroup);
        $objGrowthGroup = new GrowthGroup();
        $objGrowthGroup->Group = $objGroup;
        $objGrowthGroup->GrowthGroupLocationId = $objGgRow['growth_group_location_id'];
        $objGrowthGroup->GrowthGroupDayTypeId = $objGgRow['growth_group_day_type_id'];
        $objGrowthGroup->MeetingBitmap = $objGgRow['meeting_bitmap'];
        $objGrowthGroup->StartTime = $objGgRow['start_time'];
        $objGrowthGroup->EndTime = $objGgRow['end_time'];
        $objGrowthGroup->Address1 = $objGgRow['address_1'];
        $objGrowthGroup->Address2 = $objGgRow['address_2'];
        $objGrowthGroup->CrossStreet1 = $objGgRow['cross_street_1'];
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      GroupCategory $value A GroupCategory object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(GroupCategory $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
<?php

/**
 * Ongoing service to ensure that any groups that are "flagged" for refresh get recalculated
 */
// Up the Memory Limit
ini_set('memory_limit', '1024M');
// Ensure we are NOT running
QApplication::CliProcessEnsureUnique();
// Setup a Lock File
QApplication::CliProcessSetupLockFile();
// Run the Logic/Code
while (QApplication::CliProcessIsLockFileValid()) {
    foreach (SmartGroup::QueryArray(QQ::IsNull(QQN::SmartGroup()->DateRefreshed)) as $objSmartGroup) {
        $objSmartGroup->RefreshParticipationList();
    }
    foreach (GroupCategory::QueryArray(QQ::IsNull(QQN::GroupCategory()->DateRefreshed)) as $objGroupCategory) {
        $objGroupCategory->RefreshParticipationList();
    }
    sleep(10);
}
Example #8
0
 public static function GenerateGroup(Ministry $objMinistry, Group $objParentGroup = null)
 {
     $strName = QDataGen::GenerateTitle(1, 4);
     $strToken = strtolower(str_replace(' ', '_', $strName));
     while (Group::LoadByToken($strToken)) {
         $strName = QDataGen::GenerateTitle(1, 4);
         $strToken = strtolower(str_replace(' ', '_', $strName));
     }
     $strDescription = QDataGen::GenerateContent(rand(0, 1), 5, 20);
     $intGroupTypeId = QDataGen::GenerateFromArray(array_keys(GroupType::$NameArray));
     $objGroup = Group::CreateGroupForMinistry($objMinistry, $intGroupTypeId, $strName, $strDescription, $objParentGroup);
     // Set folder options
     $objGroup->ConfidentialFlag = !rand(0, 8);
     // Email
     if (!rand(0, 3)) {
         $objGroup->EmailBroadcastTypeId = QDataGen::GenerateFromArray(array_keys(EmailBroadcastType::$NameArray));
         $objGroup->Token = $strToken;
     }
     $objGroup->Save();
     switch ($objGroup->GroupTypeId) {
         case GroupType::GrowthGroup:
             $objGrowthGroup = new GrowthGroup();
             $objGrowthGroup->Group = $objGroup;
             $objGrowthGroup->GrowthGroupLocationId = rand(1, GrowthGroupLocation::CountAll());
             $objGrowthGroup->Save();
             break;
         case GroupType::SmartGroup:
             $objSmartGroup = new SmartGroup();
             $objSmartGroup->Group = $objGroup;
             $objSmartGroup->Save();
             break;
         case GroupType::GroupCategory:
             $objGroupCategory = new GroupCategory();
             $objGroupCategory->Group = $objGroup;
             $objGroupCategory->Save();
             // Create Subgroups
             $intSubFolderCount = rand(0, 5);
             for ($intCount = 0; $intCount < $intSubFolderCount; $intCount++) {
                 self::GenerateGroup($objMinistry, $objGroup);
             }
             break;
     }
     // Create Participants
     $objGroupRoleArray = GroupRole::LoadArrayByMinistryId($objMinistry->Id);
     switch ($objGroup->GroupTypeId) {
         case GroupType::GrowthGroup:
         case GroupType::RegularGroup:
             $intParticipantCount = rand(1, 8);
             for ($intIndex = 0; $intIndex < $intParticipantCount; $intIndex++) {
                 $dttStartDate = QDataGen::GenerateDateTime(self::$SystemStartDate, QDateTime::Now());
                 $dttEndDate = rand(0, 4) ? null : QDataGen::GenerateDateTime($dttStartDate, QDateTime::Now());
                 $objGroup->AddPerson(Person::Load(rand(1, self::$MaxPersonId)), QDataGen::GenerateFromArray($objGroupRoleArray)->Id, $dttStartDate, $dttEndDate);
             }
             break;
     }
 }
Example #9
0
		function saveFeedItem($feedId,$feedVisibility,$item){
			global $database, $db, $event;

			$db->query("SELECT id FROM {$database['prefix']}DeleteHistory WHERE feed='$feedId' and permalink='{$item['permalink']}'");
			if ($db->numRows() > 0) 
				return false;
	
			if ($item['written']>gmmktime()+86400)
				return false;

			$item['title']=$db->escape($db->lessen(UTF8::correct($item['title'])));

			list($useRssOut) = Settings::gets('useRssOut');
		
			list($feedCreated,$localFilter,$localFilterType) = Feed::gets($feedId, 'created,filter,filterType');

			$tagString=$db->escape($db->lessen(UTF8::correct(implode(', ',$item['tags']))));

			list($globalFilter,$blackFilter,$globalFilterType,$blackFilterType) = Settings::gets('filter,blackfilter,filterType,blackfilterType');
			$filter = empty($globalFilter)?$localFilter:$globalFilter;
			$filterType = empty($globalFilter)?$localFilterType:$globalFilterType;


			if (!Validator::is_empty($filter)) {
				$filtered = true;				
				$allowTags = explode(',', $filter);

				if($filterType == 'tag' || $filterType == 'tag+title') {					
					foreach ($allowTags as $ftag) {
						if (Validator::enum($ftag, $tagString)) {
							$filtered = false;
							break;
						}
					}
				}

				if($filtered && ($filterType == 'title' || $filterType == 'tag+title')) {
					foreach ($allowTags as $ftag) {
						if(strpos($item['title'],$ftag)!==false) {
							$filtered = false;
							break;
						}
					}
				}

				if ($filtered) return false;
			}

			if (!Validator::is_empty($blackFilter)) {
				$filtered = false;
				$denyTags = explode(',', $blackFilter);
				if($blackFilterType == 'tag' || $blackFilterType == 'tag+title') {					
					foreach ($denyTags as $ftag) {
						if (Validator::enum($ftag, $tagString)) {
							$filtered = true;
							break;
						}
					}
				}
				if($filtered && ($filterType == 'title' || $filterType == 'tag+title')) {
					foreach ($denyTags as $ftag) {
						if(strpos($item['title'],$ftag)!==false) {
							$filtered = true;
							break;
						}
					}
				}

				if ($filtered) return false;
			}

			if (preg_match('/\((.[^\)]+)\)$/Ui', trim($item['author']), $_matches)) $item['author'] = $_matches[1];
			$item['author']=$db->escape($db->lessen(UTF8::correct($item['author'])));
			$item['permalink']=$db->escape($db->lessen(UTF8::correct($item['permalink'])));
			$item['description']=$db->escape($db->lessen(UTF8::correct(trim($item['description'])),65535));
			
			$enclosures = array();
			foreach($item['enclosures'] as $en) {
				array_push($enclosures, $en['url']);
			}

			$enclosureString=$db->escape($db->lessen(UTF8::correct(implode('|',$enclosures))));				

			$deadLine=0;
			$feedLife = Settings::get('archivePeriod');
			if ($feedLife > 0) $deadLine=gmmktime()-($feedLife*86400);

			requireComponent('Bloglounge.Data.FeedItems');

			$oldTags = null;
			$id = FeedItem::getIdByURL($item['permalink']);
			if($id === false && isset($item['guid'])) {
				$item['guid']=$db->escape($db->lessen(UTF8::correct($item['guid'])));
				$id = FeedItem::getIdByURL($item['guid']);
			}

			$item['author'] = Feed::getAuthor($item, $feedId, $id);
			$item['title'] = Feed::getTitle($item, $feedId, $id);

			$affected = 0;
			$isRebuildData = false;

			$summarySave = Settings::get('summarySave');
			$description = $item['description'];
			if(Validator::getBool($summarySave)) { // summarySave
				$description = func::stripHTML($item['description'].'>');
				if (substr($description, -1) == '>') $description = substr($description, 0, strlen($description) - 1);
				$description = $db->lessen(func::htmltrim($description), 1000, '');
			}
			
			if (preg_match("/^[0-9]+$/",$id)) {
				$baseItem = FeedItem::getFeedItem($id);
			//	$baseItem['title']=$db->escape(UTF8::correct($baseItem['title']));
			//	$baseItem['description']=$db->escape(UTF8::correct(trim($baseItem['description'])));

				if(($baseItem['title']!=$item['title'])) {
					$isRebuildData = true;
					$tags = FeedItem::get($id, 'tags');
					requireComponent('LZ.PHP.Media');
					Media::delete($id);

					$oldTags = func::array_trim(explode(',', $tags));
					$db->execute("UPDATE {$database['prefix']}FeedItems SET author = '{$item['author']}', title = '{$item['title']}', description = '{$description}', tags = '$tagString', enclosure = '$enclosureString', written = {$item['written']} WHERE id = $id");
				}
			} else {
				if ($item['written']==0)
					$item['written']=gmmktime();
				if ($item['written']>$deadLine) {
					$db->execute("INSERT INTO {$database['prefix']}FeedItems (feed, author, permalink, title, description, tags, enclosure, written, feedVisibility) VALUES ($feedId, '{$item['author']}', '{$item['permalink']}', '{$item['title']}', '{$description}', '$tagString', '$enclosureString', {$item['written']},'{$feedVisibility}')");

					$id =$db->insertId();
					$db->execute('UPDATE '.$database['prefix'].'Feeds SET feedCount=feedCount+1 WHERE id="'.$feedId.'"');
					if (isset($this)) $this->updated++;
				}
				$isRebuildData = true;
			}			

			if(Validator::getBool(Settings::get('saveImages'))) {
				if($description = FeedItem::saveImages($feedId, $id, $item)) {
					$db->execute("UPDATE {$database['prefix']}FeedItems SET description = '{$description}' WHERE id = $id");
				}
			}
			
			$item = $event->on('Add.updateFeedItem', array($feedId, $id, $item));
			if(count($item)==3) $item = $item[2];
	
			$result = false;
			if($isRebuildData) {
				requireComponent('Bloglounge.Data.Groups');
				GroupCategory::buildGroupCategory($id, $feedId, $item['tags']);

				Tag::buildTagIndex($id, $item['tags'], $oldTags);
					

				Category::buildCategoryRelations($id, $item['tags'], $oldTags);
				
				$isSaveThumbnail = FeedItem::cacheThumbnail($id, $item);

				// 썸네일 저장 이벤트
				$event->on('Add.thumbnailSave',array($item, $feedId, $id, $isSaveThumbnail));
				
				$result = true;
			}

			return $result;
		}
 /**
  * Exclude object from result
  *
  * @param     GroupCategory $groupCategory Object to remove from the list of results
  *
  * @return    GroupCategoryQuery The current query, for fluid interface
  */
 public function prune($groupCategory = null)
 {
     if ($groupCategory) {
         $this->addUsingAlias(GroupCategoryPeer::ID, $groupCategory->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
 /**
  * Static Helper Method to Create using PK arguments
  * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
  * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
  * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to 
  * edit, or if we are also allowed to create a new one, etc.
  * 
  * @param mixed $objParentObject QForm or QPanel which will be using this GroupCategoryMetaControl
  * @param integer $intGroupId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing GroupCategory object creation - defaults to CreateOrEdit
  * @return GroupCategoryMetaControl
  */
 public static function Create($objParentObject, $intGroupId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intGroupId)) {
         $objGroupCategory = GroupCategory::Load($intGroupId);
         // GroupCategory was found -- return it!
         if ($objGroupCategory) {
             return new GroupCategoryMetaControl($objParentObject, $objGroupCategory);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a GroupCategory object with PK arguments: ' . $intGroupId);
             }
         }
         // If EditOnly is specified, throw an exception
     } else {
         if ($intCreateType == QMetaControlCreateType::EditOnly) {
             throw new QCallerException('No PK arguments specified');
         }
     }
     // If we are here, then we need to create a new record
     return new GroupCategoryMetaControl($objParentObject, new GroupCategory());
 }
<?php

/**
 * Run at explicit times to "clear" group participation lists, which would then cause the groups-participation-calculate to
 * re-refresh the lists for all groups
 */
SmartGroup::ForceRefreshParticipations();
GroupCategory::ForceRefreshParticipations();
Example #13
0
// The array value [1] is a boolean on whether or not the group's ELEMENT1 that should be made into an individual group,
//		true means use ALL reserveids
//		or an array of awgrresf.reserveid's to use just the specified subset within that group
//		(thus ignoring the ACS Group for the groupid)
$objGroupArray = array(21 => array(63 => array('Alter Prayer Ministry', false), 26 => array('Prayer Ministry', array(104, 105, 106, 272, 314, 364, 374, 375, 383, 401)), 36 => array('PrayerWorks', false), 35 => array('Worship Warriors', false)), 23 => array(53 => array('Information Center', false), 28 => array('Worship Services', array(123, 115, 116, 278, 121, 254, 124)), 19 => array('Hospitality', false)));
foreach ($objGroupArray as $intMinistryId => $objAcsGroupArray) {
    $objMinistry = Ministry::Load($intMinistryId);
    $objRoleArray = $objMinistry->GetGroupRoleArray();
    $objRole = $objRoleArray[0];
    foreach ($objAcsGroupArray as $intAcsGroupId => $objDescriptionArray) {
        if (!$objDescriptionArray[1]) {
            $objGroup = Group::CreateGroupForMinistry($objMinistry, GroupType::RegularGroup, $objDescriptionArray[0], null);
            CreateGroupParticipations($objAcsDatabase, $objGroup, $objRole, $intAcsGroupId, null);
        } else {
            $objGroupCategory = Group::CreateGroupForMinistry($objMinistry, GroupType::GroupCategory, $objDescriptionArray[0], null);
            $objGroupCategoryDetail = new GroupCategory();
            $objGroupCategoryDetail->GroupId = $objGroupCategory->Id;
            $objGroupCategoryDetail->Save();
            foreach ($objDescriptionArray[1] as $intAcsReserveId) {
                $objResult = $objAcsDatabase->query(sprintf('select * from awgrresf where groupid=%s AND reserveid=%s;', $intAcsGroupId, $intAcsReserveId));
                while ($objRow = $objResult->fetch_array()) {
                    $objGroup = Group::CreateGroupForMinistry($objMinistry, GroupType::RegularGroup, $objRow['value'], null, $objGroupCategory);
                    CreateGroupParticipations($objAcsDatabase, $objGroup, $objRole, $intAcsGroupId, $intAcsReserveId);
                }
            }
        }
    }
    Group::RefreshHierarchyDataForMinistry($intMinistryId);
}
function CreateGroupParticipations(mysqli $objAcsDatabase, Group $objGroup, GroupRole $objRole, $intAcsGroupId, $intAcsReserveId)
{
Example #14
0
 /**
  * Override method to perform a property "Get"
  * This will get the value of $strName
  *
  * @param string $strName Name of the property to get
  * @return mixed
  */
 public function __get($strName)
 {
     switch ($strName) {
         ///////////////////
         // Member Variables
         ///////////////////
         case 'Id':
             // Gets the value for intId (Read-Only PK)
             // @return integer
             return $this->intId;
         case 'GroupTypeId':
             // Gets the value for intGroupTypeId (Not Null)
             // @return integer
             return $this->intGroupTypeId;
         case 'MinistryId':
             // Gets the value for intMinistryId (Not Null)
             // @return integer
             return $this->intMinistryId;
         case 'Name':
             // Gets the value for strName
             // @return string
             return $this->strName;
         case 'Description':
             // Gets the value for strDescription
             // @return string
             return $this->strDescription;
         case 'ParentGroupId':
             // Gets the value for intParentGroupId
             // @return integer
             return $this->intParentGroupId;
         case 'HierarchyLevel':
             // Gets the value for intHierarchyLevel
             // @return integer
             return $this->intHierarchyLevel;
         case 'HierarchyOrderNumber':
             // Gets the value for intHierarchyOrderNumber
             // @return integer
             return $this->intHierarchyOrderNumber;
         case 'ConfidentialFlag':
             // Gets the value for blnConfidentialFlag
             // @return boolean
             return $this->blnConfidentialFlag;
         case 'EmailBroadcastTypeId':
             // Gets the value for intEmailBroadcastTypeId
             // @return integer
             return $this->intEmailBroadcastTypeId;
         case 'Token':
             // Gets the value for strToken (Unique)
             // @return string
             return $this->strToken;
         case 'ActiveFlag':
             // Gets the value for blnActiveFlag
             // @return boolean
             return $this->blnActiveFlag;
         case 'Status':
             // Gets the value for intStatus
             // @return integer
             return $this->intStatus;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'Ministry':
             // Gets the value for the Ministry object referenced by intMinistryId (Not Null)
             // @return Ministry
             try {
                 if (!$this->objMinistry && !is_null($this->intMinistryId)) {
                     $this->objMinistry = Ministry::Load($this->intMinistryId);
                 }
                 return $this->objMinistry;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ParentGroup':
             // Gets the value for the Group object referenced by intParentGroupId
             // @return Group
             try {
                 if (!$this->objParentGroup && !is_null($this->intParentGroupId)) {
                     $this->objParentGroup = Group::Load($this->intParentGroupId);
                 }
                 return $this->objParentGroup;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'StatusObject':
             // Gets the value for the AvailabilityStatus object referenced by intStatus
             // @return AvailabilityStatus
             try {
                 if (!$this->objStatusObject && !is_null($this->intStatus)) {
                     $this->objStatusObject = AvailabilityStatus::Load($this->intStatus);
                 }
                 return $this->objStatusObject;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'GroupCategory':
             // Gets the value for the GroupCategory object that uniquely references this Group
             // by objGroupCategory (Unique)
             // @return GroupCategory
             try {
                 if ($this->objGroupCategory === false) {
                     // We've attempted early binding -- and the reverse reference object does not exist
                     return null;
                 }
                 if (!$this->objGroupCategory) {
                     $this->objGroupCategory = GroupCategory::LoadByGroupId($this->intId);
                 }
                 return $this->objGroupCategory;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'GrowthGroup':
             // Gets the value for the GrowthGroup object that uniquely references this Group
             // by objGrowthGroup (Unique)
             // @return GrowthGroup
             try {
                 if ($this->objGrowthGroup === false) {
                     // We've attempted early binding -- and the reverse reference object does not exist
                     return null;
                 }
                 if (!$this->objGrowthGroup) {
                     $this->objGrowthGroup = GrowthGroup::LoadByGroupId($this->intId);
                 }
                 return $this->objGrowthGroup;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'SmartGroup':
             // Gets the value for the SmartGroup object that uniquely references this Group
             // by objSmartGroup (Unique)
             // @return SmartGroup
             try {
                 if ($this->objSmartGroup === false) {
                     // We've attempted early binding -- and the reverse reference object does not exist
                     return null;
                 }
                 if (!$this->objSmartGroup) {
                     $this->objSmartGroup = SmartGroup::LoadByGroupId($this->intId);
                 }
                 return $this->objSmartGroup;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             ////////////////////////////
             // Virtual Object References (Many to Many and Reverse References)
             // (If restored via a "Many-to" expansion)
             ////////////////////////////
         ////////////////////////////
         // Virtual Object References (Many to Many and Reverse References)
         // (If restored via a "Many-to" expansion)
         ////////////////////////////
         case '_EmailMessageRoute':
             // Gets the value for the private _objEmailMessageRoute (Read-Only)
             // if set due to an expansion on the email_message_route.group_id reverse relationship
             // @return EmailMessageRoute
             return $this->_objEmailMessageRoute;
         case '_EmailMessageRouteArray':
             // Gets the value for the private _objEmailMessageRouteArray (Read-Only)
             // if set due to an ExpandAsArray on the email_message_route.group_id reverse relationship
             // @return EmailMessageRoute[]
             return (array) $this->_objEmailMessageRouteArray;
         case '_ChildGroup':
             // Gets the value for the private _objChildGroup (Read-Only)
             // if set due to an expansion on the group.parent_group_id reverse relationship
             // @return Group
             return $this->_objChildGroup;
         case '_ChildGroupArray':
             // Gets the value for the private _objChildGroupArray (Read-Only)
             // if set due to an ExpandAsArray on the group.parent_group_id reverse relationship
             // @return Group[]
             return (array) $this->_objChildGroupArray;
         case '_GroupAuthorizedSender':
             // Gets the value for the private _objGroupAuthorizedSender (Read-Only)
             // if set due to an expansion on the group_authorized_sender.group_id reverse relationship
             // @return GroupAuthorizedSender
             return $this->_objGroupAuthorizedSender;
         case '_GroupAuthorizedSenderArray':
             // Gets the value for the private _objGroupAuthorizedSenderArray (Read-Only)
             // if set due to an ExpandAsArray on the group_authorized_sender.group_id reverse relationship
             // @return GroupAuthorizedSender[]
             return (array) $this->_objGroupAuthorizedSenderArray;
         case '_GroupParticipation':
             // Gets the value for the private _objGroupParticipation (Read-Only)
             // if set due to an expansion on the group_participation.group_id reverse relationship
             // @return GroupParticipation
             return $this->_objGroupParticipation;
         case '_GroupParticipationArray':
             // Gets the value for the private _objGroupParticipationArray (Read-Only)
             // if set due to an ExpandAsArray on the group_participation.group_id reverse relationship
             // @return GroupParticipation[]
             return (array) $this->_objGroupParticipationArray;
         case '_SmsMessage':
             // Gets the value for the private _objSmsMessage (Read-Only)
             // if set due to an expansion on the sms_message.group_id reverse relationship
             // @return SmsMessage
             return $this->_objSmsMessage;
         case '_SmsMessageArray':
             // Gets the value for the private _objSmsMessageArray (Read-Only)
             // if set due to an ExpandAsArray on the sms_message.group_id reverse relationship
             // @return SmsMessage[]
             return (array) $this->_objSmsMessageArray;
         case '__Restored':
             return $this->__blnRestored;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
 /**
  * Main utility method to aid with data binding.  It is used by the default BindAllRows() databinder but
  * could and should be used by any custom databind methods that would be used for instances of this
  * MetaDataGrid, by simply passing in a custom QQCondition and/or QQClause. 
  *
  * If a paginator is set on this DataBinder, it will use it.  If not, then no pagination will be used.
  * It will also perform any sorting (if applicable).
  *
  * @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself
  * @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query		 
  * @return void
  */
 public function MetaDataBinder(QQCondition $objCondition = null, $objOptionalClauses = null)
 {
     // Setup input parameters to default values if none passed in
     if (!$objCondition) {
         $objCondition = QQ::All();
     }
     $objClauses = $objOptionalClauses ? $objOptionalClauses : array();
     // We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if ($this->Paginator) {
         $this->TotalItemCount = GroupCategory::QueryCount($objCondition, $objClauses);
     }
     // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add
     // the OrderByClause to the $objClauses array
     if ($objClause = $this->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be a Query result from GroupCategory, given the clauses above
     $this->DataSource = GroupCategory::QueryArray($objCondition, $objClauses);
 }
Example #16
0
 public static function initPricesComputation($id_customer = null)
 {
     if ($id_customer) {
         $customer = new Customer((int) $id_customer);
         if (!Validate::isLoadedObject($customer)) {
             die(Tools::displayError());
         }
         self::$_taxCalculationMethod = Group::getPriceDisplayMethod((int) $customer->id_default_group);
         $cur_cart = Context::getContext()->cart;
         $id_address = 0;
         if (Validate::isLoadedObject($cur_cart)) {
             $id_address = (int) $cur_cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')};
         }
         $address_infos = Address::getCountryAndState($id_address);
         if (self::$_taxCalculationMethod != PS_TAX_EXC && !empty($address_infos['vat_number']) && $address_infos['id_country'] != Configuration::get('VATNUMBER_COUNTRY') && Configuration::get('VATNUMBER_MANAGEMENT')) {
             self::$_taxCalculationMethod = PS_TAX_EXC;
         }
     } else {
         self::$_taxCalculationMethod = Group::getPriceDisplayMethod(Group::getCurrent()->id);
     }
 }
Example #17
0
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, GroupCategory::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
Example #18
0
 public static function loadAllGroup()
 {
     $module = new GroupCategory();
     $response = new stdClass();
     $response->status = '1';
     $response->data = $module->getAllGroup();
     die(Tools::jsonEncode($response));
 }
Example #19
0
 public function getGroupCategory($params = array('pid' => 0))
 {
     if (!isset($params['status'])) {
         $params['status'] = 1;
     }
     $model = new GroupCategory();
     $criteria = new CDbCriteria();
     $criteria->condition = '1 ';
     $criteria->order = !empty($params['order']) ? $params['order'] : 'title DESC';
     if (!empty($params)) {
         $array = array('pid', 'type');
         foreach ($params as $key => $value) {
             if (in_array($key, $array)) {
                 $criteria->condition .= " and {$key}=:{$key}";
                 $criteria->params[':' . $key] = $value;
             }
         }
     }
     $models = $model->findAll($criteria);
     return $models;
 }
Example #20
0
 public static function deleteItem()
 {
     $module = new GroupCategory();
     $module->clearCache();
     $itemId = intval($_POST['itemId']);
     $item = DB::getInstance()->getRow("Select * From " . _DB_PREFIX_ . "groupcategory_items Where id = " . $itemId);
     $response = new stdClass();
     if ($item) {
         if (DB::getInstance()->execute("Delete From " . _DB_PREFIX_ . "groupcategory_items Where id = " . $itemId)) {
             $itemLangs = DB::getInstance()->executeS("Select banner From " . _DB_PREFIX_ . "groupcategory_item_lang Where itemId = " . $itemId);
             if ($itemLangs) {
                 foreach ($itemLangs as $itemLang) {
                     if ($itemLang && file_exists($module->pathBanner . $itemLang['banner'])) {
                         unlink($module->pathBanner . $itemLang['banner']);
                     }
                 }
             }
             DB::getInstance()->execute("Delete From " . _DB_PREFIX_ . "groupcategory_item_lang Where itemId = " . $itemId);
             $response->status = '1';
             $response->msg = "Delete Item Success!";
         } else {
             $response->status = '0';
             $response->msg = "Delete Item not Success!";
         }
     } else {
         $response->status = '0';
         $response->msg = "Item not found!";
     }
     die(Tools::jsonEncode($response));
 }
Example #21
0
 /**
  * This will save this object's Group instance,
  * updating only the fields which have had a control created for it.
  */
 public function SaveGroup()
 {
     try {
         // Update any fields for controls that have been created
         if ($this->lstGroupType) {
             $this->objGroup->GroupTypeId = $this->lstGroupType->SelectedValue;
         }
         if ($this->lstMinistry) {
             $this->objGroup->MinistryId = $this->lstMinistry->SelectedValue;
         }
         if ($this->txtName) {
             $this->objGroup->Name = $this->txtName->Text;
         }
         if ($this->txtDescription) {
             $this->objGroup->Description = $this->txtDescription->Text;
         }
         if ($this->lstParentGroup) {
             $this->objGroup->ParentGroupId = $this->lstParentGroup->SelectedValue;
         }
         if ($this->txtHierarchyLevel) {
             $this->objGroup->HierarchyLevel = $this->txtHierarchyLevel->Text;
         }
         if ($this->txtHierarchyOrderNumber) {
             $this->objGroup->HierarchyOrderNumber = $this->txtHierarchyOrderNumber->Text;
         }
         if ($this->chkConfidentialFlag) {
             $this->objGroup->ConfidentialFlag = $this->chkConfidentialFlag->Checked;
         }
         if ($this->lstEmailBroadcastType) {
             $this->objGroup->EmailBroadcastTypeId = $this->lstEmailBroadcastType->SelectedValue;
         }
         if ($this->txtToken) {
             $this->objGroup->Token = $this->txtToken->Text;
         }
         if ($this->chkActiveFlag) {
             $this->objGroup->ActiveFlag = $this->chkActiveFlag->Checked;
         }
         if ($this->lstStatusObject) {
             $this->objGroup->Status = $this->lstStatusObject->SelectedValue;
         }
         // Update any UniqueReverseReferences (if any) for controls that have been created for it
         if ($this->lstGroupCategory) {
             $this->objGroup->GroupCategory = GroupCategory::Load($this->lstGroupCategory->SelectedValue);
         }
         if ($this->lstGrowthGroup) {
             $this->objGroup->GrowthGroup = GrowthGroup::Load($this->lstGrowthGroup->SelectedValue);
         }
         if ($this->lstSmartGroup) {
             $this->objGroup->SmartGroup = SmartGroup::Load($this->lstSmartGroup->SelectedValue);
         }
         // Save the Group object
         $this->objGroup->Save();
         // Finally, update any ManyToManyReferences (if any)
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }