コード例 #1
0
 public function updateMusicianProfile($memberID, $changeKey, $ageRangeID, $genderID, $music, $locationChangeKey, $countryID, $stateID, $cityID, $regionID, $dbConnection)
 {
     $success = false;
     $update = false;
     try {
         $memberDetails = new Member();
         $memberDetails->setVariable(Member::MEMBER_ID, $memberID);
         if ($changeKey != null) {
             ChangeUtilities::processChangeItem($memberDetails, $changeKey, MemberEditConstants::AGE_CHANGE_KEY, Member::AGE_RANGE_ID, $ageRangeID, $update);
             ChangeUtilities::processChangeItem($memberDetails, $changeKey, MemberEditConstants::GENDER_CHANGE_KEY, Member::GENDER_ID, $genderID, $update);
             ChangeUtilities::processChangeItem($memberDetails, $changeKey, MemberEditConstants::MUSIC_CHANGE_KEY, Member::MUSIC, $music, $update);
         }
         if (stripos($locationChangeKey, LocationConstants::REGION_CHANGE_KEY) !== false || stripos($locationChangeKey, LocationConstants::CITY_CHANGE_KEY) !== false || stripos($locationChangeKey, LocationConstants::STATE_CHANGE_KEY) !== false || stripos($locationChangeKey, LocationConstants::COUNTRY_CHANGE_KEY) !== false) {
             if ($countryID == 'defaultValue' || $countryID == '0') {
                 $countryID = 0;
                 $stateID = 0;
                 $cityID = 0;
                 $regionID = 0;
             } else {
                 if ($stateID == 'defaultValue' || $stateID == '0') {
                     $stateID = 0;
                     $cityID = 0;
                     $regionID = 0;
                 } else {
                     if ($cityID == 'defaultValue' || $cityID == '0') {
                         $cityID = 0;
                         $regionID = 0;
                     } else {
                         if ($regionID == 'defaultValue' || $regionID == '0') {
                             $regionID = 0;
                         }
                     }
                 }
             }
             $memberDetails->setVariable(LocationConstants::COUNTRY_ID, $countryID);
             $memberDetails->setVariable(LocationConstants::STATE_ID, $stateID);
             $memberDetails->setVariable(LocationConstants::CITY_ID, $cityID);
             $memberDetails->setVariable(LocationConstants::REGION_ID, $regionID);
             $update = true;
         }
         if ($update) {
             MemberDao::updateMember($memberDetails, $dbConnection);
         }
         $success = true;
     } catch (Exception $ex) {
         $success = false;
         echo 'Caught exception: ', $ex->getMessage(), "\n";
     }
     return $success;
 }
コード例 #2
0
 public function updateAdvertisementPosition($advertisementPositionID, $changeKey, $advertisementID, $memberID, $positionNumber, $instrumentID, $durationID, $description, $experienceID, $ageRangeID, $genderID, $dbConnection = null)
 {
     $processed = false;
     $update = false;
     try {
         if ($changeKey != null) {
             $position = new AdvertisementPosition();
             $position->setVariable(AdvertisementPosition::ADVERTISEMENT_POSITION_ID, $advertisementPositionID);
             $position->setVariable(AdvertisementPosition::ADVERTISEMENT_ID, $advertisementID);
             ChangeUtilities::processChangeItem($position, $changeKey, AdvertisementPositionConstants::POSITION_NUMBER_CHANGE_KEY, AdvertisementPosition::POSITION_NUMBER, $positionNumber, $update);
             ChangeUtilities::processChangeItem($position, $changeKey, AdvertisementPositionConstants::POSITION_TYPE_CHANGE_KEY, AdvertisementPosition::INSTRUMENT_ID, $instrumentID, $update);
             ChangeUtilities::processChangeItem($position, $changeKey, AdvertisementPositionConstants::POSITION_DURATION_CHANGE_KEY, AdvertisementPosition::DURATION_ID, $durationID, $update);
             ChangeUtilities::processChangeItem($position, $changeKey, AdvertisementPositionConstants::POSITION_EXP_CHANGE_KEY, AdvertisementPosition::EXPERIENCE_ID, $experienceID, $update);
             ChangeUtilities::processChangeItem($position, $changeKey, AdvertisementPositionConstants::POSITION_AGE_CHANGE_KEY, AdvertisementPosition::AGE_RANGE_ID, $ageRangeID, $update);
             ChangeUtilities::processChangeItem($position, $changeKey, AdvertisementPositionConstants::POSITION_GENDER_CHANGE_KEY, AdvertisementPosition::GENDER_ID, $genderID, $update);
             ChangeUtilities::processChangeItem($position, $changeKey, AdvertisementPositionConstants::POSITION_OTHER_CHANGE_KEY, AdvertisementPosition::DESCRIPTION, $description, $update);
             if ($update) {
                 $processed = AdvertisementPositionDao::updateAdvertisementPosition($memberID, $position, $dbConnection);
             }
         }
     } catch (Exception $ex) {
         $processed = false;
         echo 'Caught exception: ' . $ex->getMessage();
     }
     return $processed;
 }
コード例 #3
0
 public function updateBand($memberID, $bandID, $changeKey, $bandName, $website, $facebook, $myspace, $twitter, $description, $contactInfo, $inspiration, $summary, $locationChangeKey, $countryID, $stateID, $cityID, $regionID, $dbConnection = null)
 {
     $success = false;
     $update = false;
     try {
         $bandDetails = new Band();
         $bandDetails->setVariable(Band::BAND_ID, $bandID);
         ChangeUtilities::processChangeItem($bandDetails, $changeKey, BandEditConstants::BAND_NAME_CHANGE_KEY, Band::NAME, $bandName, $update);
         ChangeUtilities::processChangeItem($bandDetails, $changeKey, BandEditConstants::BAND_WEBSITE_CHANGE_KEY, Band::WEBSITE, $website, $update);
         ChangeUtilities::processChangeItem($bandDetails, $changeKey, BandEditConstants::ABOUT_CHANGE_KEY, Band::DESCRIPTION, $description, $update);
         ChangeUtilities::processChangeItem($bandDetails, $changeKey, BandEditConstants::CONTACT_INFORMATION_CHANGE_KEY, Band::CONTACT_INFORMATION, $contactInfo, $update);
         ChangeUtilities::processChangeItem($bandDetails, $changeKey, BandEditConstants::INSPIRATIONS_CHANGE_KEY, Band::INSPIRATION, $inspiration, $update);
         ChangeUtilities::processChangeItem($bandDetails, $changeKey, BandEditConstants::SUMMARY_CHANGE_KEY, Band::SUMMARY, $summary, $update);
         ChangeUtilities::processChangeItem($bandDetails, $changeKey, BandEditConstants::FACEBOOK_CHANGE_KEY, Band::FACEBOOK_URL, $facebook, $update);
         ChangeUtilities::processChangeItem($bandDetails, $changeKey, BandEditConstants::MYSPACE_CHANGE_KEY, Band::MYSPACE_URL, $myspace, $update);
         ChangeUtilities::processChangeItem($bandDetails, $changeKey, BandEditConstants::TWITTER_CHANGE_KEY, Band::TWITTER_URL, $twitter, $update);
         //                    if (stripos($changeKey, BandEditConstants::GENRE_CHANGE_KEY) !== false)
         //                    {
         //                         if ($dbConnection = null)
         //                            $dbConnection = DatabaseUtilities::getDatabaseConnection();
         //
         //                        BandGenreDao::deleteBandGenres($bandID, $dbConnection);
         //                        BandGenreDao::insertBandGenres($bandID, $_POST[BandEditConstants::GENRE_INPUT_ID], $dbConnection);
         //                    }
         //                    if (stripos($changeKey, BandEditConstants::LOGO_CHANGE_KEY) !== false)
         //                    {
         ////                        echo "processing band logo <br/>";
         //                        if ($_FILES['logoInput']['tmp_name'] != null)
         //                        {
         //                            $imageName = BandUpdateController::processBandLogo();
         //                            $bandDetails->setVariable(Band::IMAGE_ID, $imageName);
         //
         //                            if ($dbConnection = null)
         //                                $dbConnection = DatabaseUtilities::getDatabaseConnection();
         //
         ////                            echo "Inserting band image <br/>";
         //                            BandImageDao::updateBandImage($bandID, 1, $imageName);
         ////                             echo "Done band image";
         //                        }
         //                    }
         if (stripos($locationChangeKey, LocationConstants::REGION_CHANGE_KEY) !== false || stripos($locationChangeKey, LocationConstants::CITY_CHANGE_KEY) !== false || stripos($locationChangeKey, LocationConstants::STATE_CHANGE_KEY) !== false || stripos($locationChangeKey, LocationConstants::COUNTRY_CHANGE_KEY) !== false) {
             if ($countryID == 'defaultValue' || $countryID == '0') {
                 $countryID = 0;
                 $stateID = 0;
                 $cityID = 0;
                 $regionID = 0;
             } else {
                 if ($stateID == 'defaultValue' || $stateID == '0') {
                     $stateID = 0;
                     $cityID = 0;
                     $regionID = 0;
                 } else {
                     if ($cityID == 'defaultValue' || $cityID == '0') {
                         $cityID = 0;
                         $regionID = 0;
                     } else {
                         if ($regionID == 'defaultValue' || $regionID == '0') {
                             $regionID = 0;
                         }
                     }
                 }
             }
             $bandDetails->setVariable(LocationConstants::COUNTRY_ID, $countryID);
             $bandDetails->setVariable(LocationConstants::STATE_ID, $stateID);
             $bandDetails->setVariable(LocationConstants::CITY_ID, $cityID);
             $bandDetails->setVariable(LocationConstants::REGION_ID, $regionID);
             $update = true;
         }
         if ($update) {
             BandDao::updateBand($memberID, $bandDetails, $dbConnection);
         }
         $success = true;
     } catch (Exception $ex) {
         echo 'Caught exception: ', $ex->getMessage(), "\n";
         $success = false;
     }
     return $success;
 }
コード例 #4
0
 /**
  * Updates an advertisement object. Uses a change key to determine if values have been updated.
  *
  * @param int $memberID
  * @param String $changeKey
  * @param int $advertisementID
  * @param int $advertisementTypeID
  * @param int $bandID
  * @param String $summary
  * @param String $inspirations
  * @param String $description
  * @param String $locationChangeKey
  * @param int $countryID
  * @param int $stateID
  * @param int $cityID
  * @param int $regionID
  * @param connection $dbConnection
  * @return boolean
  */
 public function updateAdvertisement($memberID, $changeKey, $advertisementID, $advertisementTypeID, $bandID, $summary, $inspirations, $description, $locationChangeKey, $countryID, $stateID, $cityID, $regionID, $dbConnection = null)
 {
     $success = false;
     $update = false;
     try {
         $advertisementDetails = new Advertisement();
         $advertisementDetails->setVariable(Advertisement::ADVERTISEMENT_ID, $advertisementID);
         if ($changeKey != null) {
             ChangeUtilities::processChangeItem($advertisementDetails, $changeKey, AdvertisementEditConstants::FOR_INPUT_CHANGE_KEY, Advertisement::ADVERTISEMENT_TYPE_ID, $advertisementTypeID, $update);
             ChangeUtilities::processChangeItem($advertisementDetails, $changeKey, AdvertisementEditConstants::BAND_INPUT_CHANGE_KEY, Advertisement::BAND_ID, $bandID, $update);
             ChangeUtilities::processChangeItem($advertisementDetails, $changeKey, AdvertisementEditConstants::SUMMARY_INPUT_CHANGE_KEY, Advertisement::SUMMARY, $summary, $update);
             ChangeUtilities::processChangeItem($advertisementDetails, $changeKey, AdvertisementEditConstants::INSPIRATION_INPUT_CHANGE_KEY, Advertisement::INSPIRATIONS, $inspirations, $update);
             ChangeUtilities::processChangeItem($advertisementDetails, $changeKey, AdvertisementEditConstants::DESCRIPTION_INPUT_CHANGE_KEY, Advertisement::OTHER_INFORMATION, $description, $update);
         }
         //If any location value has been changed, update all location fields.
         if (stripos($locationChangeKey, LocationConstants::REGION_CHANGE_KEY) !== false || stripos($locationChangeKey, LocationConstants::CITY_CHANGE_KEY) !== false || stripos($locationChangeKey, LocationConstants::STATE_CHANGE_KEY) !== false || stripos($locationChangeKey, LocationConstants::COUNTRY_CHANGE_KEY) !== false) {
             if ($countryID == 'defaultOption' || $countryID == '0') {
                 $countryID = 0;
                 $stateID = 0;
                 $cityID = 0;
                 $regionID = 0;
             } else {
                 if ($stateID == 'defaultOption' || $stateID == '0') {
                     $stateID = 0;
                     $cityID = 0;
                     $regionID = 0;
                 } else {
                     if ($cityID == 'defaultOption' || $cityID == '0') {
                         $cityID = 0;
                         $regionID = 0;
                     } else {
                         if ($regionID == 'defaultOption' || $regionID == '0') {
                             $regionID = 0;
                         }
                     }
                 }
             }
             $advertisementDetails->setVariable(LocationConstants::COUNTRY_ID, $countryID);
             $advertisementDetails->setVariable(LocationConstants::STATE_ID, $stateID);
             $advertisementDetails->setVariable(LocationConstants::CITY_ID, $cityID);
             $advertisementDetails->setVariable(LocationConstants::REGION_ID, $regionID);
             $update = true;
         }
         if ($update) {
             AdvertisementDao::updateAdvertisement($memberID, $advertisementDetails, $dbConnection);
         }
         //Success is indicated by reaching this point, we are not concerned if no update was made.
         $success = true;
     } catch (Exception $ex) {
         //    			echo 'Caught exception: ',  $ex->getMessage(), "\n";
         $success = false;
     }
     return $success;
 }