/** * @param int $lowestGlobalRanking * @param int $applicationId * @param bool $localQuiz * @return QuizPendingRankingUpdate */ static function add( $lowestGlobalRanking, $applicationId, $localQuiz ) { $clusterIdentifier = ($localQuiz) ? ClusterTool::clusterIdentifier() : ''; $qpru = self::fetchObject( self::definition(), null, array( 'cluster_identifier' => $clusterIdentifier, 'application_id' => $applicationId ) ); if( !$qpru ) $qpru = new self(); else { if( (int)$qpru->attribute( 'lowest_global_ranking' ) > $lowestGlobalRanking ) return false; } $qpru->setAttribute( 'lowest_global_ranking', $lowestGlobalRanking ); $qpru->setAttribute( 'cluster_identifier', $clusterIdentifier ); $qpru->setAttribute( 'application_id', $applicationId ); $qpru->store(); return $qpru; }
/** * @param string $content * @return array */ static function add( $content ) { $currentMMUser = MMUsers::getCurrentUserObject(); if( !$currentMMUser ) return false; $prcuh = self::fetchObject( self::definition(), null, array( 'md5_uuid' => md5( $currentMMUser->attribute( 'uuid' ) ) ) ); if( !$prcuh ) { $prcuh = new self(); $prcuh->setAttribute( 'md5_uuid', md5( $currentMMUser->attribute( 'uuid' ) ) ); } if( $prcuh && $content != 'undefined' ) { $prcuh->setAttribute( 'content', $content ); } $prcuh->store(); return array( 'token' => $prcuh->attribute( 'md5_uuid' ) ); }