Example #1
0
 /**
  * @param int $home
  * @param int $away
  * @param int $week
  *
  * @return Fixture
  */
 private function createFixture($home, $away, $week)
 {
     $fixture = new Fixture();
     $fixture->setTeamHome($home);
     $fixture->setTeamAway($away);
     $fixture->setWeek($week);
     return $fixture;
 }
 public function setUp()
 {
     // add one site
     Fixture::createWebsite($this->date, $ecommerce = 1, $siteName = "Site #0", $siteUrl = "http://whatever.com/");
     // add two goals
     $goals = API::getInstance();
     $goals->addGoal($this->idSite, 'all', 'url', 'http', 'contains', false, 5);
     $goals->addGoal($this->idSite, 'all', 'url', 'thing2', 'contains');
     $start = Date::factory($this->date);
     $dates = array();
     for ($day = 0; $day != 31; ++$day) {
         $dates[] = $start->addDay($day);
     }
     $t = BenchmarkTestCase::getLocalTracker($this->idSite);
     $actionNum = 0;
     foreach ($dates as $date) {
         for ($visitNum = 0; $visitNum != 1000; ++$visitNum) {
             if ($visitNum % 2 == 0) {
                 $url = "http://whatever.com/{$actionNum}/0/1/2/3/4/5/6/7/8/9";
                 $referrerUrl = "http://google.com/?q={$actionNum}";
             } else {
                 $url = "http://whatever.com/thing2/{$actionNum}/0/1/2/3/4/5/6/7/8/9";
                 $referrerUrl = "http://";
             }
             $title = "A page title / {$actionNum} / 0 / 1 / 2 / 3 / 4 / 5 / 6 / 7 / 8 /9";
             $t->setNewVisitorId();
             $t->setForceVisitDateTime($date);
             $t->setUrl($url);
             $t->setUrlReferrer($referrerUrl);
             Fixture::checkResponse($t->doTrackPageView($title));
             ++$actionNum;
         }
     }
 }
Example #3
0
 public function addLanguage()
 {
     ipRequest()->mustBePost();
     $data = ipRequest()->getPost();
     if (empty($data['code'])) {
         throw new \Ip\Exception('Missing required parameter');
     }
     $code = $data['code'];
     $abbreviation = strtoupper($code);
     $url = $code;
     $languages = ipContent()->getLanguages();
     foreach ($languages as $language) {
         if ($language->getCode() == $code) {
             return new \Ip\Response\Json(array('error' => 1, 'errorMessage' => __('This language already exist.', 'Ip-admin', false)));
         }
     }
     $languages = Fixture::languageList();
     $directionality = Service::TEXT_DIRECTION_LTR;
     if (!empty($languages[$code])) {
         $language = $languages[$code];
         $title = $language['nativeName'];
         if (!empty($language['directionality']) && $language['directionality'] == 'rtl') {
             $directionality = Service::TEXT_DIRECTION_RTL;
         }
     } else {
         $title = $code;
     }
     Service::addLanguage($title, $abbreviation, $code, $url, 1, $directionality);
     return new \Ip\Response\Json(array());
 }
Example #4
0
 public function testWebArchiving()
 {
     if (self::isMysqli() && self::isTravisCI()) {
         $this->markTestSkipped('Skipping on Mysqli as it randomly fails.');
     }
     self::$fixture->setUp();
     self::deleteArchiveTables();
     $host = Fixture::getRootUrl();
     $token = Fixture::getTokenAuth();
     $urlTmp = Option::get('piwikUrl');
     Option::set('piwikUrl', $host . 'tests/PHPUnit/proxy/index.php');
     $streamContext = stream_context_create(array('http' => array('timeout' => 180)));
     $url = $host . 'tests/PHPUnit/proxy/archive.php?token_auth=' . $token . '&forcelogtoscreen=1';
     $output = file_get_contents($url, 0, $streamContext);
     // ignore random build issues
     if (empty($output) || strpos($output, \Piwik\CronArchive::NO_ERROR) === false) {
         $message = "This test has failed. Because it sometimes randomly fails, we skip the test, and ignore this failure.\n";
         $message .= "If you see this message often, or in every build, please investigate as this should only be a random and rare occurence!\n";
         $message .= "\n\narchive web failed: " . $output . "\n\nurl used: {$url}";
         $this->markTestSkipped($message);
     }
     if (!empty($urlTmp)) {
         Option::set('piwikUrl', $urlTmp);
     } else {
         Option::delete('piwikUrl');
     }
     $this->assertContains('Starting Piwik reports archiving...', $output);
     $this->assertContains('Archived website id = 1', $output);
     $this->assertContains('Done archiving!', $output);
     $this->compareArchivePhpOutputAgainstExpected($output);
 }
 /**
  * @expectedException \TheIconic\Fixtures\Exception\FixtureException
  */
 public function testIllegalAdd()
 {
     $fixtureCities = Fixture::create($this->testParsedDataCities);
     $this->testFixtureCollection->add($fixtureCities);
     $fixtureCities = Fixture::create($this->testParsedDataFood);
     $this->testFixtureCollection->add($fixtureCities);
 }
 public function getApiForTesting()
 {
     // we will test all segments from all plugins
     Fixture::loadAllPlugins();
     $apiToCall = array('VisitsSummary.get', 'CustomVariables.getCustomVariables');
     return array(array($apiToCall, array('idSite' => 'all', 'date' => self::$fixture->dateTime, 'periods' => array('day', 'week'), 'setDateLastN' => true, 'segment' => $this->getSegmentToTest())));
 }
 public function setUp()
 {
     // add one thousand sites
     $allIdSites = array();
     for ($i = 0; $i < 1000; ++$i) {
         $allIdSites[] = Fixture::createWebsite($this->date, $ecommerce = 1, $siteName = "Site #{$i}");
     }
     $urls = array();
     for ($i = 0; $i != 3; ++$i) {
         $url = "http://whatever.com/" . ($i - 1) . "/" . ($i + 1);
         $title = "page view " . ($i - 1) . " / " . ($i + 1);
         $urls[$url] = $title;
     }
     $visitTimes = array();
     $date = Date::factory($this->date);
     for ($i = 0; $i != 4; ++$i) {
         $visitTimes[] = $date->addHour($i)->getDatetime();
     }
     // add 12000 visits (3 visitors with 4 visits each for each site) w/ 3 pageviews each on one day
     foreach ($visitTimes as $visitTime) {
         foreach ($allIdSites as $idSite) {
             for ($visitor = 0; $visitor != 3; ++$visitor) {
                 $t = BenchmarkTestCase::getLocalTracker($idSite);
                 $ip = "157.5.6." . ($visitor + 1);
                 $t->setIp($ip);
                 $t->setNewVisitorId();
                 $t->setForceVisitDateTime($visitTime);
                 foreach ($urls as $url => $title) {
                     $t->setUrl($url);
                     $t->doTrackPageView($title);
                 }
             }
         }
     }
 }
Example #8
0
 public static function convert_kickoff_time($kickoff)
 {
     $data = explode(" ", $kickoff);
     $month = Fixture::get_month_year_array();
     $timezone = Fixture::get_match_timezone();
     $timestamp = $month[$data[1]]["year"] . "-" . $month[$data[1]]["month"] . "-" . $data[0] . " {$data[2]}:00";
     $date = new DateTime($timestamp, $timezone);
     return $date->format("Y-m-d H:i:s");
 }
Example #9
0
function checkPiwikSetupForTests()
{
    if (empty($_SERVER['REQUEST_URI']) || $_SERVER['REQUEST_URI'] == '@REQUEST_URI@') {
        echo "WARNING: for tests to pass, you must first:\n1) Install webserver on localhost, eg. apache\n2) Make these Piwik files available on the webserver, at eg. http://localhost/dev/piwik/\n3) Install Piwik by going through the installation process\n4) Copy phpunit.xml.dist to phpunit.xml\n5) Edit in phpunit.xml the @REQUEST_URI@ and replace with the webserver path to Piwik, eg. '/dev/piwik/'\n\nTry again.\n-> If you still get this message, you can work around it by specifying Host + Request_Uri at the top of this file tests/PHPUnit/bootstrap.php. <-";
        exit(1);
    }
    $baseUrl = Fixture::getRootUrl();
    \Piwik\SettingsPiwik::checkPiwikServerWorking($baseUrl, $acceptInvalidSSLCertificates = true);
}
Example #10
0
 private static function getLanguageSelectValues()
 {
     $answer = array();
     $languages = Fixture::languageList();
     foreach ($languages as $key => $language) {
         $answer[] = array($key, $language['name'] . ' (' . $language['nativeName'] . ')');
     }
     usort($answer, array(__CLASS__, 'cmp'));
     return $answer;
 }
 protected function makeTracker($idSite, $dateTime, $debugStringAppend = '')
 {
     $tracker = parent::getTracker($idSite, $dateTime, $defaultInit = true);
     if ($this->forceLargeWindowLookBackForVisitor) {
         // Fakes the config value window_look_back_for_visitor tested in TrackerWindowLookBack
         $debugStringAppend .= '&forceLargeWindowLookBackForVisitor=1';
         // Here we force the visitor ID cookie value sent to piwik.php, to create a "unique visitor" for all visits in fixture
         // we do not use setVisitorId(), because we want shouldLookupOneVisitorFieldOnly() to return false for this particular test case
         $debugStringAppend .= '&_id=2f4f673d4732e11d';
     }
     $tracker->setDebugStringAppend($debugStringAppend);
     return $tracker;
 }
Example #12
0
 protected function issueBulkTrackingRequest($token_auth, $expectTrackingToSucceed)
 {
     $piwikHost = Fixture::getRootUrl() . 'tests/PHPUnit/proxy/piwik.php';
     $command = 'curl -s -X POST -d \'{"requests":["?idsite=1&url=http://example.org&action_name=Test bulk log Pageview&rec=1","?idsite=1&url=http://example.net/test.htm&action_name=Another bulk page view&rec=1"],"token_auth":"' . $token_auth . '"}\' ' . $piwikHost;
     exec($command, $output, $result);
     $output = implode("", $output);
     if ($result !== 0) {
         throw new Exception("tracking bulk failed: " . implode("\n", $output) . "\n\ncommand used: {$command}");
     }
     $this->assertStringStartsWith('{"status":', $output);
     if ($expectTrackingToSucceed) {
         $this->assertNotContains('error', $output);
         $this->assertContains('success', $output);
     } else {
         $this->assertContains('error', $output);
         $this->assertNotContains('success', $output);
     }
 }
 public function setUp()
 {
     for ($i = 0; $i != $this->siteCount; ++$i) {
         $idSite = Fixture::createWebsite($this->date, $ecommerce = 1, $siteName = "Site #{$i}", $siteUrl = "http://site{$i}.com/");
         API::getInstance()->addGoal($idSite, 'all', 'url', 'http', 'contains', false, 5);
     }
     // track one visit for each site
     $t = BenchmarkTestCase::getLocalTracker(1);
     $t->setForceVisitDateTime(Date::factory($this->date)->addHour(6));
     for ($idSite = 1; $idSite < $this->siteCount + 1; ++$idSite) {
         $ip = "157.5.6.4";
         $t->setIp($ip);
         $t->setNewVisitorId();
         $t->setIdSite($idSite);
         $t->setUrl("http://site" . ($idSite - 1) . ".com/page.html");
         $t->doTrackPageView('page title');
     }
 }
Example #14
0
 public function getApiForTesting()
 {
     // we will test all segments from all plugins
     Fixture::loadAllPlugins();
     $idSite = self::$fixture->idSite;
     $apiForTesting = array();
     $segments = \Piwik\Plugins\API\API::getInstance()->getSegmentsMetadata(self::$fixture->idSite);
     foreach ($segments as $segment) {
         $apiForTesting[] = $this->getApiForTestingForSegment($idSite, $segment['segment']);
     }
     if (self::isMysqli() || self::isTravisCI()) {
         // Skip the test on Mysqli as it fails due to rounding Float errors on latitude/longitude
         // then the test started failing after bc19503 and I cannot understand why
         echo "Skipped test \n";
     } else {
         $apiForTesting[] = array('Live.getLastVisitsDetails', array('idSite' => $idSite, 'date' => '1998-07-12,today', 'period' => 'range', 'otherRequestParameters' => array('filter_limit' => 1000)));
     }
     return $apiForTesting;
 }
 public static function get_fixture_id($round, $date, $team)
 {
     $query = "SELECT id FROM fixture WHERE gameweek = %d AND kickoff_time = %s AND";
     $team = explode(" ", $team);
     $team = explode("(", $team[0]);
     $team_id = Club::get_club_id_by_short($team[0]);
     if (strpos($team[1], "A") === false) {
         // playing at home
         $query = $query . " away_team = %d";
     } else {
         // playing away
         $query = $query . " home_team = %d";
     }
     $query = $query . " LIMIT 1";
     $result = DB::query($query, $round, Fixture::convert_kickoff_time($date), $team_id);
     if (sizeof($result) == 1) {
         return (int) $result[0]['id'];
     }
     return false;
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     self::updateDatabase();
     // truncate log tables so old data won't be re-archived
     foreach (array('log_visit', 'log_link_visit_action', 'log_conversion', 'log_conversion_item') as $table) {
         Db::query("TRUNCATE TABLE " . Common::prefixTable($table));
     }
     // add two visits from same visitor on dec. 29
     $t = Fixture::getTracker(1, '2012-12-29 01:01:30', $defaultInit = true);
     $t->setUrl('http://site.com/index.htm');
     $t->setIp('136.5.3.2');
     Fixture::checkResponse($t->doTrackPageView('incredible title!'));
     $t->setForceVisitDateTime('2012-12-29 03:01:30');
     $t->setUrl('http://site.com/other/index.htm');
     $t->DEBUG_APPEND_URL = '&_idvc=2';
     // make sure visit is marked as returning
     Fixture::checkResponse($t->doTrackPageView('other incredible title!'));
     // launch archiving
     VisitFrequencyApi::getInstance()->get(1, 'year', '2012-12-29');
 }
Example #17
0
 public function editpartido_post($codcampeonato, $codtorneo, $codfixture)
 {
     $codEscenario = Input::get('escenario');
     $fixture = Fixture::find($codfixture);
     $equipo1 = $fixture->codEquipo1;
     $nombre1 = Equipo::find($equipo1)->nombre;
     $nombre1 = substr($nombre1, 0, 3);
     $equipo2 = $fixture->codEquipo2;
     $nombre2 = Equipo::find($equipo2)->nombre;
     $nombre2 = substr($nombre2, 0, 3);
     $nrofecha = $fixture->nroFecha;
     $horaincio = $fixture->hora;
     $hora = substr($horaincio, 0, 2);
     $min = substr($horaincio, 3, 2);
     $horaI = (int) $hora;
     $minI = (int) $min;
     $horaI = $horaI + 1;
     $siguiente = $horaI . ":" . $minI;
     $fecha = DB::table('tfecha')->where('nroFecha', '=', $nrofecha)->where('codRueda', '=', $codtorneo)->first();
     $nro = DB::table('tprogramacion')->count();
     $idfecha = $fecha->idFecha;
     $cop = "PRO" . $idfecha . ($nro + 1);
     $programacion = new Programacion();
     $programacion->codProgramacion = $cop;
     $programacion->idFecha = $idfecha;
     $programacion->diaPartido = $fecha->diaFecha;
     $programacion->nroPartido = $fixture->nroPartido;
     $programacion->codEscenario = $codEscenario;
     $programacion->save();
     $partido = new Partido();
     $cP = "PA" . $nombre1 . $nombre2;
     $partido->codPartido = $cP;
     $partido->codProgramacion = $cop;
     $partido->horaInicio = $horaincio;
     $partido->horaFin = $siguiente;
     $partido->tipoPartido = "normal";
     $partido->save();
     return Redirect::to('/fecha/edit/' . $codcampeonato . '/' . $codtorneo . '/' . $fecha->nroFecha);
 }
 public function setUp()
 {
     // add one site
     Fixture::createWebsite($this->date, $ecommerce = 1, $siteName = "Site #0", $siteUrl = "http://whatever.com/");
     // add two goals
     $goals = API::getInstance();
     $goals->addGoal($this->idSite, 'all', 'url', 'http', 'contains', false, 5);
     $goals->addGoal($this->idSite, 'all', 'url', 'http', 'contains');
     $urls = array();
     for ($i = 0; $i != 3; ++$i) {
         $url = "http://whatever.com/" . ($i - 1) . "/" . ($i + 1);
         $title = "page view " . ($i - 1) . " / " . ($i + 1);
         $urls[$url] = $title;
     }
     $visitTimes = array();
     $date = Date::factory($this->date);
     for ($month = 0; $month != 12; ++$month) {
         for ($day = 0; $day != 25; ++$day) {
             $visitTimes[] = $date->addPeriod($month, 'MONTH')->addDay($day)->getDatetime();
         }
     }
     // add 12,000 visits (1 visit a day from 40 visitors for 25 days of every month) w/ 3 pageviews each
     foreach ($visitTimes as $visitTime) {
         for ($visitor = 0; $visitor != 40; ++$visitor) {
             $t = BenchmarkTestCase::getLocalTracker($this->idSite);
             $ip = "157.5.6." . ($visitor + 1);
             $t->setIp($ip);
             $t->setNewVisitorId();
             $t->setForceVisitDateTime($visitTime);
             foreach ($urls as $url => $title) {
                 $t->setUrl($url);
                 $t->doTrackPageView($title);
             }
         }
     }
 }
Example #19
0
                        <th class="text-center">{{$fecha->diaFecha}}</th>
                        <th>Accion</th>
                    </tr>
                    </thead>
                    <tbody>
                    @foreach($fixture as $val)
                        <tr>
                            <td>{{$val->nroPartido}}</td>
                            <td>{{$val->hora}}</td>
                            <td class="text-center">{{Equipo::find($val->codEquipo1)->nombre.' <----> '.Equipo::find($val->codEquipo2)->nombre}}</td>
                            <td>
                                <!--- encontrar cod de partido   -->
                                <?php 
$programacion = Programacion::where('idFecha', '=', $fecha->idFecha)->where('nroPartido', '=', $val->nroPartido)->first();
$partido = Partido::where('codProgramacion', '=', $programacion->codProgramacion)->first();
$fixture = Fixture::where('codRueda', '=', $torneo->codRueda)->where('nroFecha', '=', $fecha->nroFecha)->where('nroPartido', '=', $val->nroPartido)->first();
?>

                                <br>
                                <a class="label label-primary" href="{{$partido->codPartido}}/partido.html" >
                                    <span class="glyphicon glyphicon-list"></span> &nbsp;Partido
                                </a><br>
                            </td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>
            </div>
            <div class="panel-footer">
                @if($equipoquedescansa !='')
                    Descansa: {{$equipoquedescansa->nombre}}
Example #20
0
 public function tearDown()
 {
     parent::tearDown();
     Fixture::unloadAllPlugins();
 }
Example #21
0
 protected static function _addLogData()
 {
     // tracks visits on the following days:
     // - 2012-01-09
     // - 2012-01-14
     // - 2012-01-19
     // - 2012-01-24 <--- everything before this date is to be purged
     // - 2012-01-29
     // - 2012-02-03
     // - 2012-02-08
     // - 2012-02-13
     // - 2012-02-18
     // - 2012-02-23
     // - 2012-02-28
     // 6 visits in feb, 5 in jan
     // following actions are created:
     // - 'First page view'
     // - 'Second page view'
     // - 'SKU2'
     // - 'Canon SLR'
     // - 'Electronics & Cameras'
     // - for every visit (11 visits total):
     //   - http://whatever.com/_{$daysSinceLastVisit}
     //   - http://whatever.com/42/{$daysSinceLastVisit}
     $start = Date::factory(self::$dateTime);
     self::$idSite = Fixture::createWebsite('2012-01-01', $ecommerce = 1);
     $idGoal = APIGoals::getInstance()->addGoal(self::$idSite, 'match all', 'url', 'http', 'contains');
     $t = Fixture::getTracker(self::$idSite, $start, $defaultInit = true);
     $t->enableBulkTracking();
     $t->setTokenAuth(Fixture::getTokenAuth());
     for ($daysAgo = self::$daysAgoStart; $daysAgo >= 0; $daysAgo -= 5) {
         $dateTime = $start->subDay($daysAgo)->toString();
         $t->setForceVisitDateTime($dateTime);
         $t->setUserAgent('Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 (.NET CLR 3.5.30729)');
         // use $daysAgo to make sure new actions are created for every day and aren't used again.
         // when deleting visits, some of these actions will no longer be referenced in the DB.
         $t->setUrl("http://whatever.com/_{$daysAgo}");
         $t->doTrackPageView('First page view');
         $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.05));
         $t->setUrl("http://whatever.com/42/{$daysAgo}");
         $t->doTrackPageView('Second page view');
         $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.1));
         $t->setUrl("http://whatever.com/event");
         $t->doTrackEvent('Event action', 'event cat', 'daysAgo=' . $daysAgo, 1000);
         $t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.2));
         $t->addEcommerceItem($sku = 'SKU2', $name = 'Canon SLR', $category = 'Electronics & Cameras', $price = 1500, $quantity = 1);
         $t->doTrackEcommerceOrder($orderId = '937nsjusu ' . $dateTime, $grandTotal = 1111.11, $subTotal = 1000, $tax = 111, $shipping = 0.11, $discount = 666);
     }
     Fixture::checkBulkTrackingResponse($t->doBulkTrack());
 }
Example #22
0
 /**
  * @group Core
  */
 public function testIsDefined()
 {
     // setup the access layer
     $pseudoMockAccess = new FakeAccess();
     FakeAccess::$superUser = true;
     Access::setSingletonInstance($pseudoMockAccess);
     \Piwik\Translate::loadEnglishTranslation();
     Fixture::createWebsite('2009-01-04 00:11:42', true);
     $_GET['idSite'] = 1;
     WidgetsList::_reset();
     WidgetsList::add('Actions', 'Pages', 'Actions', 'getPageUrls');
     $this->assertTrue(WidgetsList::isDefined('Actions', 'getPageUrls'));
     $this->assertFalse(WidgetsList::isDefined('Actions', 'inValiD'));
 }
Example #23
0
 public function setUp()
 {
     // add one site
     Fixture::createWebsite($this->date, $ecommerce = 1, $siteName = "Site #0", $siteUrl = "http://whatever.com/");
     // add two goals
     $goals = API::getInstance();
     $goals->addGoal($this->idSite, 'all', 'url', 'http', 'contains', false, 5);
     $goals->addGoal($this->idSite, 'all', 'url', 'http', 'contains');
 }
Example #24
0
 /**
  * Helper methods
  */
 private function getStaticSrvUrl()
 {
     return Fixture::getRootUrl();
 }
Example #25
0
 public function partido($codcampeonato, $codrueda, $idfecha, $codpartido)
 {
     //$todoConclusion = Cambio::all();
     //elementos
     $fecha = Fechas::find($idfecha);
     $partido = Partido::find($codpartido);
     $programacion = Programacion::find($partido->codProgramacion);
     $torneo = Torneo::where('codRueda', '=', $codrueda)->first();
     $arbitros = Arbitro::all();
     $arbixPart = ArbitroPorPartido::where('codPartido', '=', $codpartido)->count();
     $todosArbitros = ArbitroPorPartido::where('codPartido', '=', $codpartido)->get();
     //end elementos
     $nroPartido = $programacion->nroPartido;
     $fixture = Fixture::where('codRueda', '=', $torneo->codRueda)->where('nroFecha', '=', $fecha->nroFecha)->where('nroPartido', '=', $nroPartido)->first();
     //elementos
     $equipo1 = Equipo::find($fixture->codEquipo1);
     $equipo2 = Equipo::find($fixture->codEquipo2);
     $activarPlanilla = Planilla::where('codPartido', '=', $codpartido)->first();
     $fechaactual = DB::select("select curdate() as fecha");
     $fechasiguiente = DB::select("select  adddate(curdate(),1) as fecha");
     $fechaAnterior = DB::select("select  subdate(curdate(),1) as fecha");
     $hora = DB::select("select  curtime() as hora");
     $horaAsistencia = DB::select("select  subtime(?,3000) as fecha", array($partido->horaInicio));
     foreach ($fechaactual as $value) {
         $Factual = $value->fecha;
     }
     foreach ($fechasiguiente as $value) {
         $Fsiguiente = $value->fecha;
     }
     foreach ($hora as $value) {
         $horaA = $value->hora;
     }
     foreach ($fechaAnterior as $value) {
         $Fantes = $value->fecha;
     }
     foreach ($horaAsistencia as $value) {
         $HrAistencia = $value->fecha;
     }
     ///===== es la dia de programacion
     $HH = DB::select("select  if(?=?,1,0) as fecha", array($fecha->diaFecha, $Factual));
     foreach ($HH as $value) {
         $esdiaProgramacion = $value->fecha;
     }
     //end fechaf
     // mañena es dia de programacion
     $HH = DB::select("select  if(?<?,1,0) as fecha", array($fecha->diaFecha, $Fsiguiente));
     foreach ($HH as $value) {
         $manenaProgramacion = $value->fecha;
     }
     // ayer fue dia de programacion
     $HH = DB::select("select  if(?=?,1,0) as fecha", array($fecha->diaFecha, $Fantes));
     foreach ($HH as $value) {
         $ayerFProgramacion = $value->fecha;
     }
     // si la  hora es mayor 23:50
     $HH = DB::select("select  if(?=?,1,0) as fecha", array(substr($horaA, 0, 5), "23:50"));
     foreach ($HH as $value) {
         $esHora = $value->fecha;
     }
     // es hora de inicio
     $HH = DB::select("select  if(curtime()>=? and curtime()<?,1,0) as fecha", array($partido->horaInicio, "23:50:00"));
     foreach ($HH as $value) {
         $HoraI = $value->fecha;
     }
     //hora de tomo asistencia 30 min
     $HH = DB::select("select  if(curtime()>=? and curtime()<=?,1,0) as fecha", array($HrAistencia, $partido->horaInicio));
     foreach ($HH as $value) {
         $AH = $value->fecha;
     }
     $jugadoresequipo1 = "";
     $jugadoresequipo2 = "";
     $activarPlanilla = Planilla::where('codPartido', '=', $codpartido)->first();
     if ($activarPlanilla != "") {
         $Planilla1 = Planilla::where('codPartido', '=', $codpartido)->where('nroPlantilla', '=', 1)->first();
         $Planilla2 = Planilla::where('codPartido', '=', $codpartido)->where('nroPlantilla', '=', 2)->first();
         //$fixture->codEquipo1
         //$Jequipo1 = Jugador::where('codequipo', '=', $fixture->equipo1)->get();
         //$Jequipo2 = Jugador::where('codequipo', '=', $fixture->equipo2)->get();
         //$arbitros = Arbitro::all();
         //todos los jugadores de este partido  $torneo $idtorneo,$idfecha,$idfixture)
     }
     /*
          $Delanteros1 = '';
          $Mediocampistas1 = '';
          $Defensas1 = '';
          $Guardameta1 = '';
          $suplentes1 = '';
          $jugadoresdeunpartido2 = '';
          //recuperamos los arbitros del partido
          $arbitrosdelpartido = '';
          //verificamos si el partido ya se jugó
              //recuperar los datos del partido jugado
              $arbitrosdelpartido = ArbitroPorPartido::where('codPartido','=',$partido->codPartido)->first();
     
              //resuperamos todos los jugadores de este partido  ... un rato
     /*
              $Delanteros1 = DB::table('tjugadorenjuego')
                  ->join('tjugador','tjugadorenjuego.idjugador','=','tjugador.idjugador')
                  ->join('tdocente','tdocente.coddocente','=','tjugador.coddocente')
                  ->join('tequipo','tequipo.codequipo','=','tjugador.codequipo')
                  ->where('tjugadorenjuego.codpartido','=',$partido->codpartido)
                  ->where('tjugador.codequipo','=',$fixture->equipo1)
                  ->where('tjugadorenjuego.condicionenpartido','=','delantero')
                  ->get();
              $Mediocampistas1 = DB::table('tjugadorenjuego')
                  ->join('tjugador','tjugadorenjuego.idjugador','=','tjugador.idjugador')
                  ->join('tdocente','tdocente.coddocente','=','tjugador.coddocente')
                  ->join('tequipo','tequipo.codequipo','=','tjugador.codequipo')
                  ->where('tjugadorenjuego.codpartido','=',$partido->codpartido)
                  ->where('tjugador.codequipo','=',$fixture->equipo1)
                  ->where('tjugadorenjuego.condicionenpartido','=','mediocampista')
                  ->get();
              $Defensas1 = DB::table('tjugadorenjuego')
                  ->join('tjugador','tjugadorenjuego.idjugador','=','tjugador.idjugador')
                  ->join('tdocente','tdocente.coddocente','=','tjugador.coddocente')
                  ->join('tequipo','tequipo.codequipo','=','tjugador.codequipo')
                  ->where('tjugadorenjuego.codpartido','=',$partido->codpartido)
                  ->where('tjugador.codequipo','=',$fixture->equipo1)
                  ->where('tjugadorenjuego.condicionenpartido','=','defensa')
                  ->get();
              $Guardameta1 = DB::table('tjugadorenjuego')
              ->join('tjugador','tjugadorenjuego.idjugador','=','tjugador.idjugador')
              ->join('tdocente','tdocente.coddocente','=','tjugador.coddocente')
              ->join('tequipo','tequipo.codequipo','=','tjugador.codequipo')
              ->where('tjugadorenjuego.codpartido','=',$partido->codpartido)
              ->where('tjugador.codequipo','=',$fixture->equipo1)
              ->where('tjugadorenjuego.condicionenpartido','=','guardameta')
              ->get();
              $suplentes1 = DB::table('tjugadorenjuego')
                  ->join('tjugador','tjugadorenjuego.idjugador','=','tjugador.idjugador')
                  ->join('tdocente','tdocente.coddocente','=','tjugador.coddocente')
                  ->join('tequipo','tequipo.codequipo','=','tjugador.codequipo')
                  ->where('tjugadorenjuego.codpartido','=',$partido->codpartido)
                  ->where('tjugador.codequipo','=',$fixture->equipo1)
                  ->where('tjugadorenjuego.condicionenpartido','=','suplente')
                  ->get();
              $jugadoresdeunpartido2 = DB::table('tjugadorenjuego')
                  ->join('tjugador','tjugadorenjuego.idjugador','=','tjugador.idjugador')
                  ->where('tjugadorenjuego.codpartido','=',$partido->codpartido)
                  ->where('tjugador.codequipo','=',$fixture->equipo2)
                  ->get();
     */
     $activarPlanilla = Planilla::where('codPartido', '=', $codpartido)->first();
     return View::make('user_com_organizing.fecha.partido.index', compact('fixture'))->with('idfecha', $idfecha)->with('torneo', $torneo)->with('programacion', $programacion)->with('codcampeonato', $codcampeonato)->with('arbitros', $arbitros)->with('partido', $partido)->with('arbixPart', $arbixPart)->with('todosArbitros', $todosArbitros)->with('equipo1', $equipo1)->with('equipo2', $equipo2)->with('activarPlanilla', $activarPlanilla)->with('esdiaProgramacion', $esdiaProgramacion)->with('manenaProgramacion', $manenaProgramacion)->with('ayerFProgramacion', $ayerFProgramacion)->with('esHora', $esHora)->with('HoraI', $HoraI)->with('AH', $AH);
     //->with('todoConclusion', $todoConclusion);
 }
Example #26
0
                            </div>
							{{ Form::close() }}
							</div>

					</div>
				</div>
			</div>
        </div>
    @endif
    <?php 
$fechaexiste = Fechas::where('nroFecha', '=', $nrofecha)->where('codRueda', '=', $torneo->codRueda)->first();
?>

    @if(  $fechaexiste = Fechas::where('nroFecha', '=',$nrofecha )->where('codRueda','=',$torneo->codRueda)->first())
        <?php 
$fixturefecha = Fixture::where('nroFecha', '=', $nrofecha)->where('codRueda', '=', $torneo->codRueda)->get();
?>
        <div class="row row-no-gutter col-no-gutter-container" id="fecha">
            <div class="col-md-12 col-no-gutter ">
                <div class="panel panel-default">
                    <div class="panel-heading">PROGRAMAR PARTIDOS DE LA FECHA {{$nrofecha}}
                    </div>
                    <!-- BEGIN PARA MANEJO DE ERRORES -->
                    @include('alerts.allerrors')
                    @include('alerts.errors')
                    <!-- END PARA MANEJO DE ERRORES -->
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-md-6">

                                <table data-toggle="table" data-url="tables/data2.json">
Example #27
0
 private function completeUrl($query)
 {
     $host = Fixture::getRootUrl();
     if (false === strpos($query, '?')) {
         $query .= '?';
     } else {
         $query .= '&';
     }
     return $host . 'tests/PHPUnit/proxy/index.php' . $query . 'testmode=1&token_auth=' . $this->authToken;
 }
Example #28
0
 public function testGetCustomSetterWillReturnTheCustomSetterValue()
 {
     $setFixture = new Fixture(self::USER, 'user', ['__set' => 'setterFunc'], null);
     $noSetFixture = new Fixture(self::USER, 'user', [], null);
     $this->assertEquals('setterFunc', $setFixture->getCustomSetter());
     $this->assertNull($noSetFixture->getCustomSetter());
 }
Example #29
0
<?php

require_once 'core/init.php';
$pageTitle = 'Add a Fixture';
$user = new User();
if (!$user->isLoggedIn()) {
    Redirect::to('login.php');
}
// Defaults
$style = '';
$displayErrors = "none";
$errorDisplay = "";
$fixture = new Fixture();
if (Input::exists()) {
    if (Token::check(Input::get('token'))) {
        $validate = new Validation();
        $validation = $validate->check($_POST, array('cheritonTeam' => array('name' => 'Team', 'required' => true), 'competition' => array('name' => 'Competition', 'required' => true), 'opponent' => array('name' => 'Opponent', 'required' => true), 'homegame' => array('name' => 'Home or Away', 'required' => true), 'location' => array('name' => 'Location', 'required' => true), 'date' => array('name' => 'Date', 'required' => true), 'kickoff' => array('name' => 'Kick Off Time', 'required' => true)));
        if ($validation->passed()) {
            $dateClean = str_replace('/', '-', Input::get('date'));
            $date = date('Y-m-d', strtotime($dateClean));
            $isHomeGame = false;
            $kickOff = Input::get('kickoff');
            if (Input::get('homegame') == "true") {
                $isHomeGame = true;
            }
            if (strlen(Input::get('kickoff'))) {
                $kickOff = Input::get('kickoff');
            }
            try {
                $fixture->create(array('TeamId' => Input::get('cheritonTeam'), 'CompetitionId' => Input::get('competition'), 'LocationId' => Input::get('location'), 'OpponentId' => Input::get('opponent'), 'HomeGame' => $isHomeGame, 'Date' => $date, 'KickOff' => $kickOff));
                Session::flash('success', 'Fixture Added Successfully');
Example #30
0
 public function detail($codcampeonato, $idtorneo, $idfecha)
 {
     $torneo = Torneo::where('codRueda', '=', $idtorneo)->first();
     $fecha = Fechas::where('idFecha', '=', $idfecha)->first();
     $fixture = Fixture::where('nroFecha', '=', $fecha->nroFecha)->where('codRueda', '=', $idtorneo)->get();
     $fixturedeequipoqueescansa = Fixtureaux::where('nroFecha', '=', $fecha->nroFecha)->where('codRueda', '=', $idtorneo)->first();
     $equipoquedescansa = '';
     // $todoConclusion = Cambio::all();
     if ($fixturedeequipoqueescansa != '') {
         if ($fixturedeequipoqueescansa->codEquipo1 == '') {
             $equipoquedescansa = Equipo::where('codEquipo', '=', $fixturedeequipoqueescansa->codEquipo2)->first();
         } else {
             $equipoquedescansa = Equipo::where('codEquipo', '=', $fixturedeequipoqueescansa->codEquipo1)->first();
         }
     }
     return View::make('user_com_organizing.fecha.detail', compact('fecha'))->with('fixture', $fixture)->with('torneo', $torneo)->with('equipoquedescansa', $equipoquedescansa)->with('codcampeonato', $codcampeonato);
 }