예제 #1
0
 function play($stage_id)
 {
     $stage = $this->dbUtil->get(new Stage(), new C(Q::eq(Stage::columnId(), $stage_id)));
     if (!Variable::istype('Stage', $stage)) {
         $this->_notFound();
         return $this->parser();
     }
     $this->setVariable('object', $stage);
     if ($this->isPost()) {
         // add comment
         $this->setVariable('stage_id', $stage->id);
         if ($this->dbUtil->insert($this->toObject(new Comment()))) {
             Header::redirect(Rhaco::url('play/' . $stage->id));
         }
     }
     $stage_file_name = Rhaco::path(sprintf('stages/%d.apif', $stage->id));
     $stage_data = unserialize(file_get_contents($stage_file_name));
     foreach ($stage_data as &$v) {
         if (preg_match('/^images.*?gif$/', $v['value'])) {
             $v['value'] = Rhaco::url($v['value']);
         }
     }
     $this->setVariable('stage_data', $stage_data);
     $this->setVariable('comments', $this->dbUtil->select(new Comment(), new C(Q::eq(Comment::columnStageId(), $stage->id))));
     return $this->parser('play.html');
 }
예제 #2
0
    /**
     * Constructeur de Gestionnaire
     * Charge toutes les données depuis la BD et les stocke dans cet objet
     */
    private function __construct()
    {
        $pdo = myPDO::getInstance();
        // Affecte les enseignants
        $stmt = $pdo->prepare(<<<SQL
      SELECT MAX(idPers) AS maxPersonne
      FROM PERSONNE
SQL
);
        $stmt->execute();
        $data = $stmt->fetch();
        $maxPersonne = $data["maxPersonne"];
        for ($i = 1; $i <= $maxPersonne; $i++) {
            $this->listeEnseignants[] = Enseignant::createFromID($i);
        }
        // Affecte les entreprises
        $stmt = $pdo->prepare(<<<SQL
      SELECT MAX(idEnt) AS maxEntreprise
      FROM ENTREPRISE
SQL
);
        $stmt->execute();
        $data = $stmt->fetch();
        $maxEntreprise = $data["maxEntreprise"];
        for ($i = 1; $i <= $maxEntreprise; $i++) {
            $this->listeEntreprises[] = Entreprise::createFromID($i);
        }
        $stmt = $pdo->prepare(<<<SQL
      SELECT MAX(idPers) AS maxPersonne
      FROM PERSONNE
SQL
);
        $stmt->execute();
        $data = $stmt->fetch();
        $maxPersonne = $data["maxPersonne"];
        for ($i = 1; $i <= $maxPersonne; $i++) {
            $this->listeEtudiants[] = Etudiant::createFromID($i);
        }
        // Affecte les offres
        $stmt = $pdo->prepare(<<<SQL
      SELECT *
      FROM OFFRESTAGE
      ORDER BY datePublication DESC
SQL
);
        $stmt->execute();
        while (($data = $stmt->fetch()) !== false) {
            $this->listeOffres[] = OffreStage::createFromID($data["idOffre"]);
        }
        // Affecte les stages
        $stmt = $pdo->prepare(<<<SQL
      SELECT idEtu, idOffre, idEns
      FROM STAGE
SQL
);
        $stmt->execute();
        while (($ligne = $stmt->fetch()) !== false) {
            $this->listeStages[] = Stage::createFromIDs($ligne["idEtu"], $ligne["idOffre"], $ligne["idEns"]);
        }
    }
예제 #3
0
 public function reject($user, $feedback)
 {
     $this->approval_state = 0;
     $this->feedback = $feedback;
     $this->save();
     Stage::previousWorkflow($this, $this->{$workflow_stage_id});
 }
    public function getCMSFields()
    {
        $fields = parent::getCMSFields();
        $fields->removeByName('Order');
        $fields->removeByName('ProcessInfo');
        $fields->removeByName('ProcessStages');
        $processParent = Process::get();
        if ($processParent) {
            $fields->insertAfter(new DropdownField('ParentID', 'Belongs to this Process', $processParent->map('ID', 'Title')), 'Title');
        }
        $fields->addFieldToTab('Root.Main', $processSteps = new CompositeField(new GridField('ProcessInfo', 'Information for this stage', $this->ProcessInfo(), GridFieldConfig_RelationEditor::create())));
        $fields->insertBefore(new LiteralField('StageTitle', '<h3 class="process-info-header">
			<span class="step-label">
				<span class="flyout">1.1</span><span class="arrow"></span>
				<span class="title">Stop stage details</span>
			</span>
		</h3>'), 'Title');
        $fields->insertBefore(new LiteralField('StageTitle', '<h3 class="process-info-header">
			<span class="step-label">
				<span class="flyout">1.2</span><span class="arrow"></span>
				<span class="title">Final information</span>
			</span>
		</h3>'), 'ProcessInfo');
        return $fields;
    }
예제 #5
0
 public function run()
 {
     DB::table('stage')->delete();
     Stage::create(array('name' => 'Finale'));
     Stage::create(array('name' => '1/2 finales', 'next_stage' => 1));
     Stage::create(array('name' => '1/4 de finale', 'next_stage' => 2));
     Stage::create(array('name' => '1/8 de finale', 'next_stage' => 3));
     Stage::create(array('name' => '3e place'));
 }
예제 #6
0
파일: Stage.php 프로젝트: Cclleemm/worldcup
 public static function getStartStage()
 {
     $nexts_id = array();
     foreach (Stage::select('next_stage')->where('next_stage', '<>', 'NULL')->get() as $value) {
         $nexts_id[] = $value->next_stage;
     }
     $start_stage_id = Stage::whereNotIn('id', $nexts_id)->first();
     return $start_stage_id;
 }
예제 #7
0
 public function NumberOfStagesWithStops()
 {
     if (Stage::get()) {
         $stage = ProcessStage::get()->filter("ParentID", $this->ID)->Count();
         $stop = ProcessStopStage::get()->filter("ParentID", $this->ID)->Count();
         return $stage + $stop;
     } else {
         return 0;
     }
 }
 public function install()
 {
     $status = array();
     // Create database field table
     $status[] = Symphony::Database()->query("CREATE TABLE `tbl_fields_dynamictextgroup` (\n\t\t\t\t\t`id` int(11) unsigned NOT NULL auto_increment,\n\t\t\t\t\t`field_id` int(11) unsigned NOT NULL,\n\t\t\t\t\t`fieldcount` tinyint(1),\n\t\t\t\t\t`schema` varchar(255),\n        \t  \t\tPRIMARY KEY  (`id`),\n\t\t\t  \t\tKEY `field_id` (`field_id`)\n\t\t\t\t)");
     // Create stage
     $status[] = Stage::install();
     // Report status
     if (in_array(false, $status, true)) {
         return false;
     } else {
         return true;
     }
 }
    public function getCMSFields()
    {
        $fields = parent::getCMSFields();
        $fields->removeByName('Order');
        $fields->removeByName('ProcessInfo');
        $fields->removeByName('StopStageID');
        $fields->removeByName('StopButton');
        $fields->removeByName('ContinueButton');
        $fields->removeByName('DecisionPoint');
        $fields->removeByName('CaseFinal');
        $fields->insertBefore(new LiteralField('StageTitle', '<h3 class="process-info-header">
			<span class="step-label">
				<span class="flyout">3</span><span class="arrow"></span>
				<span class="title">Stage Settings</span>
			</span>
		</h3>'), 'Title');
        $caseFinalMap = ProcessCase::get()->filter(array('ParentProcessID' => $this->ParentID))->map("ID", "Title")->toArray();
        asort($caseFinalMap);
        $case = ListboxField::create('CaseFinal', 'Final step for these Cases')->setMultiple(true)->setSource($caseFinalMap)->setAttribute('data-placeholder', _t('ProcessAdmin.Cases', 'Cases', 'Placeholder text for a dropdown'));
        $fields->insertAfter($case, 'Title');
        $fields->insertAfter($group = new CompositeField($label = new LabelField('switchLabel', 'Act as Decision Point'), new CheckboxField('DecisionPoint', '')), 'ParentID');
        $group->addExtraClass("field special process-noborder");
        $label->addExtraClass("left");
        $fields->dataFieldByName('Content')->setRows(10);
        if ($this->ID > 0) {
            $fields->addFieldToTab('Root.Main', new LiteralField('SaveRecord', '<p></p>'));
            $fields->addFieldToTab('Root.Main', $processInfo = new CompositeField($grid = new GridField('ProcessInfo', 'Information for this stage', $this->ProcessInfo()->sort(array('TypeID' => 'ASC', 'ProcessCaseID' => 'ASC', 'LinksToAnotherStageID' => 'ASC')), $gridConfig = GridFieldConfig_RelationEditor::create())));
            $gridConfig->addComponent(new GridFieldSortableRows('Order'));
            $processInfo->addExtraClass('process-spacing');
            $grid->addExtraClass('toggle-grid');
        } else {
            $fields->addFieldToTab('Root.Main', new LiteralField('SaveRecord', '<p class="message info">Save this stage to add info</p>'));
        }
        $fields->insertBefore(new LiteralField('StageTitleInfo', '<h3 class="process-info-header">
				<span class="step-label">
					<span class="flyout">4</span><span class="arrow"></span>
					<span class="title">Information</span>
				</span>
			</h3>'), 'SaveRecord');
        $stopStage = ProcessStopStage::get();
        if ($stopStage) {
            $fields->insertBefore($inner = new CompositeField(new LiteralField('Decision', '<h3>Decision Point</h3>'), new LiteralField('ExplainStop', '<label class="right">Choose a stop stage if you would like this stage to act as a decision point</label>'), $stop = new DropdownField('StopStageID', 'Stop Stage', $stopStage->map('ID', 'Title')), $continue = new TextField('ContinueButton', 'Button: Continue (e.g. "Yes")'), new TextField('StopButton', 'Button: Stop (e.g. "No")')), 'ProcessInfo');
            $stop->setEmptyString('No stop after this stage');
            $inner->addExtraClass('message special toggle-decide');
            $continue->addExtraClass('process-noborder');
            $stop->addExtraClass('process-noborder');
        }
        return $fields;
    }
예제 #10
0
 private function setRound()
 {
     $start_stage_id = Stage::getStartStage()->id;
     $next_stage_id = $start_stage_id;
     while ($next_stage_id) {
         $games = array();
         $this->labels[] = Stage::find($next_stage_id)->name;
         $next_stage_id_tmp = Stage::find($next_stage_id)->next_stage;
         foreach (Game::whereRaw('stage_id = ?', array($next_stage_id))->orderBy('stage_game_num', 'ASC')->get() as $value) {
             $score1 = $value->team1_goals;
             $score2 = $value->team2_goals;
             if ($value->team1_kick_at_goal != null && $value->team2_kick_at_goal != null) {
                 $score1 .= " (" . $value->team1_kick_at_goal . ")";
             }
             if ($value->team1_kick_at_goal != null && $value->team2_kick_at_goal != null) {
                 $score2 .= " (" . $value->team2_kick_at_goal . ")";
             }
             $games[] = array(array('name' => $value->team1()->first() ? $value->team1()->first()->name : "-", 'id' => $value->team1_id, 'score' => $score1), array('name' => $value->team2()->first() ? $value->team2()->first()->name : "-", 'id' => $value->team2_id, 'score' => $score2));
         }
         $this->rounds[] = $games;
         if ($next_stage_id_tmp == null) {
             $gamme = Game::whereRaw('stage_id = ? && stage_game_num = 1', array($next_stage_id))->first();
             //Vinqueur
             $this->rounds[] = array(array(array('name' => $gamme->winner()->first() ? $gamme->winner()->first()->name : "-", 'id' => $gamme->winner_id)));
         }
         $next_stage_id = $next_stage_id_tmp;
     }
     /////////////////////////////////////////////////
     //******************* 3e place ****************//
     /////////////////////////////////////////////////
     $stage_third = Stage::getThirdStage()->id;
     $gamme_third = Game::whereRaw('stage_id = ?', array($stage_third))->first();
     if ($gamme_third != null) {
         $score1 = $value->team1_goals;
         $score2 = $value->team2_goals;
         if ($gamme_third->team1_kick_at_goal != null && $gamme_third->team2_kick_at_goal != null) {
             $score1 .= " (" . $gamme_third->team1_kick_at_goal . ")";
         }
         if ($gamme_third->team1_kick_at_goal != null && $gamme_third->team2_kick_at_goal != null) {
             $score2 .= " (" . $gamme_third->team2_kick_at_goal . ")";
         }
         $this->third[] = array(array(array('name' => $gamme_third->team1()->first() ? $gamme_third->team1()->first()->name : "-", 'id' => $gamme_third->team1_id, 'score' => $score2), array('name' => $gamme_third->team2()->first() ? $gamme_third->team2()->first()->name : "-", 'id' => $gamme_third->team2_id, 'score' => $score2)));
         //Vinqueur 3e place
         $this->third[] = array(array(array('name' => $gamme_third->winner()->first() ? $gamme_third->winner()->first()->name : "-", 'id' => $gamme_third->winner_id)));
     }
 }
    public function getCMSFields()
    {
        $fields = parent::getCMSFields();
        $fields->removeByName('Order');
        $fields->removeByName('Content');
        $fields->removeByName('ProcessCaseID');
        $case = ProcessCase::get();
        if ($case) {
            $fields->insertBefore($caseOptions = new DropdownField('ProcessCaseID', 'Case', $case->map('ID', 'Title')), 'StageID');
            $caseOptions->setEmptyString('All');
        }
        $fields->insertAfter(new HiddenField("TypeOrder"), 'TypeID');
        $fields->insertAfter($content = new HTMLEditorField("Content"), 'ProcessCaseID');
        $content->setRows(15);
        $fields->insertAfter($links = new DropdownField('LinksToAnotherStageID', 'Links To Another Stage', Stage::get()->map('ID', 'Title')), 'StageID');
        $links->setEmptyString(' ');
        $fields->insertBefore(new LiteralField('InfoTitle', '<h3 class="process-info-header">
			<span class="step-label">
				<span class="flyout">5</span><span class="arrow"></span>
				<span class="title">Information Piece</span>
			</span>
		</h3>'), 'Title');
        return $fields;
    }
예제 #12
0
 case 'editStage':
     require_once 'classes/model/Stage.php';
     //$oJSON = new Services_JSON();
     $oData = Bootstrap::json_decode(stripslashes($_POST['data']));
     $oStage = new Stage();
     $aFields = $oStage->load($oData->stg_uid);
     $aFields['THEINDEX'] = $oData->theindex;
     $aFields['action'] = 'updateStage';
     global $G_PUBLISH;
     $G_PUBLISH = new Publisher();
     $G_PUBLISH->AddContent('xmlform', 'xmlform', 'tracker/tracker_StageEdit', '', $aFields, '../tracker/tracker_Ajax');
     G::RenderPage('publish', 'raw');
     break;
 case 'updateStage':
     require_once 'classes/model/Stage.php';
     $oStage = new Stage();
     $aFields = $oStage->load($_POST['form']['STG_UID']);
     $aFields['STG_TITLE'] = $_POST['form']['STG_TITLE'];
     $oStage->update($aFields);
     break;
 case 'tasksAssigned':
     require_once 'classes/model/Stage.php';
     require_once 'classes/model/Task.php';
     //$oJSON = new Services_JSON();
     $oData = Bootstrap::json_decode(stripslashes($_POST['data']));
     $oCriteria = new Criteria('workflow');
     $oCriteria->addSelectColumn(TaskPeer::TAS_UID);
     $oCriteria->addAsColumn('TAS_TITLE', ContentPeer::CON_VALUE);
     $aConditions = array();
     $aConditions[] = array(0 => TaskPeer::TAS_UID, 1 => ContentPeer::CON_ID);
     $aConditions[] = array(0 => ContentPeer::CON_CATEGORY, 1 => DBAdapter::getStringDelimiter() . 'TAS_TITLE' . DBAdapter::getStringDelimiter());
예제 #13
0
include_once "myPDO.include.php";
include_once "autoload.inc.php";
include_once "class/entreprise.class.php";
require_once "init.inc.php";
if (isset($_REQUEST['titre']) && isset($_REQUEST['description']) && isset($_REQUEST['gratification']) && isset($_REQUEST['domaine']) && isset($_REQUEST['dateDebut']) && isset($_REQUEST['dateFin']) && isset($_REQUEST['nbPostes']) && isset($_REQUEST['id'])) {
    $dateDebut = date("Y-m-d", strtotime($_REQUEST['dateDebut']));
    $dateFin = date("Y-m-d", strtotime($_REQUEST['dateFin']));
    $entrepriseChoisi = null;
    foreach ($user->getEntreprises() as $key => $entreprise) {
        if ($entreprise->getId() == $_REQUEST['id']) {
            $entrepriseChoisi = $entreprise;
        }
    }
    if ($_REQUEST['nbPostes'] >= 1 && $dateFin != false && $dateDebut != false && $entreprise != null) {
        $stage = new Stage();
        $entreprise = $user->getEntreprises();
        $stage->setTitre($_REQUEST['titre']);
        $stage->setDescription($_REQUEST['description']);
        $stage->setGratification($_REQUEST['gratification']);
        $stage->setDateDebut($dateDebut);
        $stage->setDateFin($dateFin);
        $stage->setDomaine($_REQUEST['domaine']);
        $stage->setEntreprise($entrepriseChoisi);
        $stage->setNbPoste($_REQUEST['nbPostes']);
        $stage->save();
        $pdo = myPDO::getInstance();
        $req = $pdo->prepare(<<<SQL
\t    \tSELECT numStage
\t    \tFROM Stage
\t    \tORDER BY dateCreation DESC LIMIT 1
예제 #14
0
 /**
  * @param Stage $stage
  *
  * @return bool
  */
 public function equals(Stage $stage)
 {
     return $this->name() == $stage->name();
 }
예제 #15
0
 /**
  * @see http://symphony-cms.com/learn/api/2.2/toolkit/field/#displayPublishPanel
  */
 function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
 {
     // Houston, we have problem: we've been called out of context!
     $callback = Administration::instance()->getPageCallback();
     if ($callback['context']['page'] != 'edit' && $callback['context']['page'] != 'new') {
         return;
     }
     // Stage
     Administration::instance()->Page->addScriptToHead(URL . '/extensions/datetime/lib/stage/stage.publish.js', 101, false);
     Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/datetime/lib/stage/stage.publish.css', 'screen', 102, false);
     // Datetime
     Administration::instance()->Page->addScriptToHead(URL . '/extensions/datetime/assets/datetime.publish.js', 103, false);
     Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/datetime/assets/datetime.publish.css', 'screen', 104, false);
     // Calendar
     Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/datetime/lib/calendar/calendar.publish.css', 'screen', 105, false);
     Administration::instance()->Page->addScriptToHead(URL . '/extensions/datetime/lib/calendar/calendar.publish.js', 106, false);
     // Timer
     Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/datetime/lib/timer/timer.publish.css', 'screen', 107, false);
     Administration::instance()->Page->addScriptToHead(URL . '/extensions/datetime/lib/timer/timer.publish.js', 108, false);
     // Help
     $help = '';
     if ($this->get('range') == 1 && $this->get('required') == 'yes') {
         $help = '<i>' . __('Range: <code>shift</code> + click') . '</i>';
     } elseif ($this->get('range') == 1 && $this->get('required') == 'no') {
         $help = '<i>' . __('Optional') . ', ' . __('range: <code>shift</code> + click') . '</i>';
     } elseif ($this->get('range') == 0 && $this->get('required') == 'no') {
         $help = '<i>' . __('Optional') . '</i>';
     }
     // Field label
     $fieldname = 'fields[' . $this->get('element_name') . ']';
     $label = new XMLElement('label', $this->get('label') . $help);
     $wrapper->appendChild($label);
     // Get settings
     $settings = array();
     $stage = Stage::getComponents($this->get('id'));
     if (in_array('constructable', $stage)) {
         $settings[] = 'multiple';
     } else {
         $settings[] = 'single';
     }
     if ($this->get('prepopulate') == 1) {
         $settings[] = 'prepopulate';
     }
     if ($this->get('range') == 0) {
         $settings[] = 'simple';
     }
     // Existing dates
     $content = array();
     if (is_array($data)) {
         if (!is_array($data['start'])) {
             $data['start'] = array($data['start']);
         }
         if (!is_array($data['end'])) {
             $data['end'] = array($data['end']);
         }
         for ($i = 0; $i < count($data['start']); $i++) {
             $content[] = Calendar::createDate($this->get('element_name'), $data['start'][$i], $data['end'][$i], NULL, $this->get('prepopulate'), $this->get('time'));
         }
     } else {
         $content[] = Calendar::createDate($this->get('element_name'), NULL, NULL, NULL, $this->get('prepopulate'), $this->get('time'));
     }
     // Add template
     $content[] = Calendar::createDate($this->get('element_name'), NULL, NULL, 'template empty create', $this->get('prepopulate'), $this->get('time'));
     // Create stage
     $stage = Stage::create('datetime', $this->get('id'), implode($settings, ' '), $content);
     // Append Stage
     if ($stage) {
         if (!is_null($flagWithError)) {
             $wrapper->appendChild(Widget::wrapFormElementWithError($stage, $flagWithError));
         } else {
             $wrapper->appendChild($stage);
         }
     }
 }
예제 #16
0
 private function changeLoanStage(ConnectionInterface $con, Loan $loan, $oldStatus = null, $newStatus, \DateTime $date = null)
 {
     $date = $date ?: new \DateTime();
     $newLoanStage = new Stage();
     $newLoanStage->setLoan($loan)->setBorrower($loan->getBorrower())->setStatus($newStatus)->setStartDate($date);
     if ($oldStatus) {
         $currentLoanStage = StageQuery::create()->filterByLoan($loan)->findOneByStatus($oldStatus);
         if ($currentLoanStage) {
             $currentLoanStage->setEndDate($date);
             $currentLoanStage->save($con);
         }
     }
     $newLoanStageSuccess = $newLoanStage->save($con);
     if (!$newLoanStageSuccess) {
         throw new \Exception();
     }
 }
예제 #17
0
파일: Game.php 프로젝트: Cclleemm/worldcup
 public function setFinished($num_team)
 {
     //Si l'équipe une a gagnée, on redistribue les points pour les paris corrects (paris sur l'équipe une)
     if ($num_team == 1) {
         foreach (Bet::whereRaw('game_id = ? && winner_id = ?', array($this->id, $this->team1_id))->get() as $bet) {
             $cote = $this->getTeam1CoteAttribute();
             $points = $bet->points * $cote;
             if ($this->team1_goals == $bet->team1_goals && $this->team2_goals == $bet->team2_goals) {
                 $points += $bet->points / 10 * $cote;
             }
             Transaction::addTransaction($bet->user_id, $bet->id, $points, 'gain');
         }
         $this->winner_id = $this->team1_id;
         //Si l'équipe deux a gagnée, on redistribue les points pour les paris corrects (paris sur l'équipe deux)
     } else {
         foreach (Bet::whereRaw('game_id = ? && winner_id = ?', array($this->id, $this->team2_id))->get() as $bet) {
             $cote = $this->getTeam2CoteAttribute();
             $points = $bet->points * $cote;
             if ($this->team1_goals == $bet->team1_goals && $this->team2_goals == $bet->team2_goals) {
                 $points += $bet->points / 10 * $cote;
             }
             Transaction::addTransaction($bet->user_id, $bet->id, $points, 'gain');
         }
         $this->winner_id = $this->team2_id;
     }
     /////////////////////////////////////////////////
     //******************* ROUND X *****************//
     /////////////////////////////////////////////////
     //On inscrit l'équipe gagnante dans son prochain match
     $id = $this->stage()->first()->next_stage()->first()->id;
     $num_game = round($this->stage_game_num / 2);
     $game = Game::whereRaw("stage_id = ? && stage_game_num = ?", array($id, $num_game))->first();
     if ($this->stage_game_num % 2 == 1) {
         $game->team1_id = $this->winner_id;
     } else {
         $game->team2_id = $this->winner_id;
     }
     $game->save();
     /////////////////////////////////////////////////
     //******************* 3e place ****************//
     /////////////////////////////////////////////////
     //Si on est lors des demi, on va définir aussi la 3e finale
     if ($this->stage()->first()->next_stage()->first()->next_stage == null) {
         $stage_third = Stage::getThirdStage()->id;
         $gamme_third = Game::whereRaw('stage_id = ?', array($stage_third))->first();
         //Si équipe 1 a gagné on met l'équipe 2 en 3e place
         if ($num_game == 1) {
             if ($this->stage_game_num % 2 == 1) {
                 $gamme_third->team1_id = $this->team1_id;
             } else {
                 $gamme_third->team2_id = $this->team1_id;
             }
         } else {
             if ($this->stage_game_num % 2 == 1) {
                 $gamme_third->team1_id = $this->team2_id;
             } else {
                 $gamme_third->team2_id = $this->team2_id;
             }
         }
         $gamme_third->save();
     }
     $this->save();
 }
예제 #18
0
 function actionSaveStage($currentUser)
 {
     $backUrl = $this->context->getFlowScopeAttr("backUrl");
     $stage = new Stage();
     $stageErrs = array();
     $stage->setId($this->context->getRequestAttr("id"));
     $stage->setPid($this->context->getRequestAttr("projectID"));
     $stage->setOrderis($this->context->getRequestAttr("order"));
     $stage->setName($this->context->getRequestAttr("name"));
     if (!is_null($stage->getName())) {
         $stage->setName(trim($stage->getName()));
         if (strlen($stage->getName()) < 1) {
             $stage->setName(null);
         }
     }
     if (is_null($stage->getName())) {
         $stageErrs["name"] = "field.error.empty";
     }
     $stage->setAbout($this->context->getRequestAttr("about"));
     if (!is_null($stage->getAbout())) {
         $stage->setAbout(trim($stage->getAbout()));
         if (strlen($stage->getAbout()) < 1) {
             $stage->setAbout(null);
         }
     }
     $stage->setPeriod_type($this->context->getRequestAttr("period_type"));
     $stage->setPeriod($this->context->getRequestAttr("period"));
     if (!is_null($stage->getPeriod())) {
         $stage->setPeriod(trim($stage->getPeriod()));
         if (strlen($stage->getPeriod()) < 1) {
             $stage->setPeriod(null);
         }
     }
     if (is_null($stage->getPeriod())) {
         $stageErrs["period"] = "field.error.empty";
     } else {
         if (!is_numeric($stage->getPeriod())) {
             $stageErrs["period"] = "field.error.notnumber";
         } else {
             if ($stage->getPeriod() < 1) {
                 $stageErrs["period"] = "field.error.morethenzero";
             }
         }
     }
     $stage->setDelay($this->context->getRequestAttr("delay"));
     if (!is_null($stage->getDelay())) {
         $stage->setDelay(trim($stage->getDelay()));
         if (strlen($stage->getDelay()) < 1) {
             $stage->setDelay(null);
         }
     }
     if (is_null($stage->getDelay())) {
         $stageErrs["delay"] = "field.error.empty";
     } else {
         if (!is_numeric($stage->getDelay())) {
             $stageErrs["delay"] = "field.error.notnumber";
         } else {
             if ($stage->getDelay() < 0) {
                 $stageErrs["delay"] = "field.error.morethenzero";
             }
         }
     }
     $stage->setEnded_stage($this->context->getRequestAttr("ended_stege"));
     $stage->setCancel_customer($this->context->getRequestAttr("cancel_customer"));
     $stage->setEnded_stage_pid("");
     $stage->setCancel_customer_pid("");
     if ($stage->getEnded_stage() != "0" && !is_null($stage->getEnded_stage())) {
         $endedStagePid = $this->context->getRequestAttr("ended_stage_pid");
         if (is_null($endedStagePid) || count($endedStagePid) == 0) {
             $stageErrs["ended_stege_pid"] = "field.error.needselectproject";
         } else {
             $stage->setEnded_stage_pid(implode(",", $endedStagePid));
         }
     }
     if ($stage->getCancel_customer() != "0" && !is_null($stage->getCancel_customer())) {
         $cancelCustomerPid = $this->context->getRequestAttr("cancel_customer_pid");
         if (is_null($cancelCustomerPid) || count($cancelCustomerPid) == "0") {
             $stageErrs["cancel_customer_pid"] = "field.error.needselectproject";
         } else {
             $stage->setCancel_customer_pid(implode(",", $cancelCustomerPid));
         }
     }
     $last = $this->context->getRequestAttr("last");
     $stage->setLast($last == 1 ? true : false);
     $send = $this->context->getRequestAttr("send");
     $stage->setSend($send == 1 ? true : false);
     $stage->setApi(null);
     $stage->setCampaign(null);
     if ($stage->isSend()) {
         $stage->setApi($this->context->getRequestAttr("api"));
         if (!is_null($stage->getApi())) {
             $stage->setApi(trim($stage->getApi()));
             if (strlen($stage->getApi()) < 1) {
                 $stage->setApi(null);
             }
         }
         if (is_null($stage->getApi())) {
             $stageErrs["api"] = "field.error.empty";
         }
         $stage->setCampaign($this->context->getRequestAttr("campaign"));
         if (!is_null($stage->getCampaign())) {
             $stage->setCampaign(trim($stage->getCampaign()));
             if (strlen($stage->getCampaign()) < 1) {
                 $stage->setCampaign(null);
             }
         }
         if (is_null($stage->getCampaign())) {
             $stageErrs["campaign"] = "field.error.empty";
         } else {
             if (preg_match('/\\s/', $stage->getCampaign())) {
                 $stageErrs["campaign"] = "Netinkamas pavadinimas. Negalimi tarpai";
             }
         }
     }
     $send_mail = $this->context->getRequestAttr("send_mail");
     $stage->setSend_mail($send_mail == 1 ? true : false);
     if ($stage->isSend_mail()) {
         $leader = $this->context->getRequestAttr("leader");
         $partner = $this->context->getRequestAttr("partner");
         $customer = $this->context->getRequestAttr("customer");
         $sendTo = (!is_null($leader) ? "leader" : "") . (!is_null($partner) ? "partner" : "") . (!is_null($customer) ? "customer" : "");
         $stage->setSend_to($sendTo);
         if (!is_null($stage->getSend_to())) {
             $stage->setSend_to(trim($stage->getSend_to()));
             if (strlen($stage->getSend_to()) < 1) {
                 $stage->setSend_to(null);
             }
         }
         if (is_null($stage->getSend_to())) {
             $stageErrs["send_to"] = "field.error.needatleestone";
         }
         $stage->setSend_from($this->context->getRequestAttr("send_from"));
         if (!is_null($stage->getSend_from())) {
             $stage->setSend_from(trim($stage->getSend_from()));
             if (strlen($stage->getSend_from()) < 1) {
                 $stage->setSend_from(null);
             }
         }
         if (is_null($stage->getSend_from())) {
             $stageErrs["send_from"] = "field.error.empty";
         } else {
             if (!$this->validateEmail($stage->getSend_from())) {
                 $stageErrs["send_to"] = "field.error.wrongemail";
             }
         }
         $stage->setSend_subject($this->context->getRequestAttr("send_subject"));
         if (!is_null($stage->getSend_subject())) {
             $stage->setSend_subject(trim($stage->getSend_subject()));
             if (strlen($stage->getSend_subject()) < 1) {
                 $stage->setSend_subject(null);
             }
         }
         if (is_null($stage->getSend_subject())) {
             $stageErrs["send_subject"] = "field.error.empty";
         }
         $stage->setSend_text($this->context->getRequestAttr("send_text"));
         if (!is_null($stage->getSend_text())) {
             $stage->setSend_text(trim($stage->getSend_text()));
             if (strlen($stage->getSend_text()) < 1) {
                 $stage->setSend_text(null);
             }
         }
         if (is_null($stage->getSend_text())) {
             $stageErrs["send_text"] = "field.error.empty";
         }
     }
     //$stageErrs["apisss"]=1;
     $timeZone = new DateTimeZone("Europe/Vilnius");
     $time = new DateTime("now", $timeZone);
     $stage->setR_date($time->format("Y-m-d H:i:s"));
     $stage->setR_user($currentUser->getId());
     $this->context->setFlashScopeAttr("stage", $stage);
     $this->context->setFlashScopeAttr("stageErrs", $stageErrs);
     $projectID = $stage->getPid();
     if (!$this->setStoreProject($projectID, "stageProject")) {
         $this->cancelStageEdit();
         if (!is_null($backUrl)) {
             header("Location: " . $backUrl);
             return true;
         }
         return false;
     }
     if (count($stageErrs) >= 1) {
         if (!is_null($backUrl)) {
             header("Location: " . $backUrl);
             return true;
         }
         return false;
     }
     $store = $this->storeStage($stage);
     if (!$store) {
         if (!is_null($backUrl)) {
             header("Location: " . $backUrl);
             return true;
         }
         return false;
     }
     $this->cancelStageEdit();
     if (!is_null($backUrl)) {
         header("Location: " . $backUrl);
         return true;
     }
     return false;
 }
 function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
 {
     // Append assets
     Administration::instance()->Page->addScriptToHead(URL . '/extensions/dynamictextgroup/lib/stage/stage.publish.js', 101, false);
     Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/dynamictextgroup/lib/stage/stage.publish.css', 'screen', 102, false);
     Administration::instance()->Page->addScriptToHead(URL . '/extensions/dynamictextgroup/assets/dynamictextgroup.publish.js', 103, false);
     Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/dynamictextgroup/assets/dynamictextgroup.publish.css', 'screen', 104, false);
     // Get settings
     $settings = array();
     $stage = Stage::getComponents($this->get('id'));
     if (in_array('constructable', $stage)) {
         $settings[] = 'multiple';
     } else {
         $settings[] = 'single';
     }
     $fieldCount = $this->get('fieldcount');
     $entryCount = count($data['textfield1']);
     // Check if schema exists and compile info
     $schema = $this->get('schema');
     if ($schema && $schema != '') {
         $fieldLabels = array();
         $fieldWidths = array();
         $splitMe = explode('|', $schema);
         foreach ($splitMe as $i => $field) {
             $index = $i + 1;
             $splitAgain = explode(',', $field);
             $fieldLabels[$i] = $splitAgain[0] && $splitAgain[0] != null ? $splitAgain[0] : null;
             $fieldWidths[$i] = $splitAgain[1] && $splitAgain[1] != null ? (int) $splitAgain[1] : null;
         }
     } else {
         $fieldLabels = null;
         $fieldWidths = null;
     }
     $fieldWidths = Textgroup::getWidths($fieldCount, $fieldWidths);
     // Populate existing entries
     $content = array();
     if (is_array($data)) {
         $fieldValues = array();
         for ($i = 0; $i < $fieldCount; $i++) {
             if (!is_array($data['textfield' . ($i + 1)])) {
                 $data['textfield' . ($i + 1)] = array($data['textfield' . ($i + 1)]);
             }
         }
         for ($i = 0; $i < $entryCount; $i++) {
             for ($n = 0; $n < $fieldCount; $n++) {
                 $entryValues[$i][$n] = $data['textfield' . ($n + 1)][$i];
             }
             $content[] = Textgroup::createNewTextGroup($this->get('element_name'), $fieldCount, $entryValues[$i], null, $fieldLabels, $fieldWidths);
         }
     } else {
         $content[] = Textgroup::createNewTextGroup($this->get('element_name'), $fieldCount, NULL, NULL, $fieldLabels, $fieldWidths);
     }
     // Add template
     $content[] = Textgroup::createNewTextGroup($this->get('element_name'), $fieldCount, NULL, 'template empty create', $fieldLabels, $fieldWidths);
     // Create stage
     $stage = Stage::create('dynamictextgroup', $this->get('id'), implode($settings, ' '), $content);
     // Field label
     $holder = new XMLElement('div');
     $label = new XMLElement('label', $this->get('label') . '<i>' . __('Help') . '</i>');
     $holder->appendChild($label);
     // Append Stage
     if ($stage) {
         $holder->appendChild($stage);
     }
     if ($flagWithError != NULL) {
         $wrapper->appendChild(Widget::wrapFormElementWithError($holder, $flagWithError));
     } else {
         $wrapper->appendChild($holder);
     }
 }
예제 #20
0
    $email->isHTML(true);
    $email->Subject = $_REQUEST['titre'];
    $email->Body = $_REQUEST['contenu'];
    $email->Body .= <<<HTML
\t\t<br/><br/>
\t\t<p>-------------------- <br/>
\t\t  <a href="candidature.php?id={$id}&loginEtudiant={$user->getId()}">Cliquez ici</a> pour valider la candidature.<br/>
\t\t  <a href="candidature.php?id={$id}&loginEtudiant={$user->getId()}">https://candidature.php?id={$id}&loginEtudiant={$user->getId()}<br/>
\t\t  ---------------------
\t\t</p>
HTML;
    $dir = opendir("/home/Etudiants/pecca001/public_html/" . $dossier_pdf);
    $match = array();
    while (false !== ($entry = readdir($dir))) {
        if (fnmatch($nomFichier . "*", $entry)) {
            $email->AddAttachment("../" . $dossier_pdf . "/" . $entry);
            $match[] = $entry;
        }
    }
    // envoi mail et suppression des pdf uploadés
    $email->Send();
    foreach ($match as $key => $value) {
        unlink("../" . $dossier_pdf . "/" . $value);
        //Supprime le fichier
    }
    // mise à jour de la base de données
    $user->postulerStage(Stage::creatFromId($_REQUEST['id']));
    header("Location: viewStage.php?id={$_GET['id']}&postuler=true");
} else {
    header("Location: viewStage.php?id={$_GET['id']}&postuler=false");
}
예제 #21
0
 public function create($aData)
 {
     $oConnection = Propel::getConnection(StagePeer::DATABASE_NAME);
     try {
         if (isset($aData['STG_UID']) && $aData['STG_UID'] == '') {
             unset($aData['STG_UID']);
         }
         if (!isset($aData['STG_UID'])) {
             $aData['STG_UID'] = G::generateUniqueID();
         }
         $oStage = new Stage();
         $oStage->fromArray($aData, BasePeer::TYPE_FIELDNAME);
         $oStage->setStgTitle($aData['STG_TITLE']);
         if ($oStage->validate()) {
             $oConnection->begin();
             $iResult = $oStage->save();
             $oConnection->commit();
             return $aData['STG_UID'];
         } else {
             $sMessage = '';
             $aValidationFailures = $oStage->getValidationFailures();
             foreach ($aValidationFailures as $oValidationFailure) {
                 $sMessage .= $oValidationFailure->getMessage() . '<br />';
             }
             throw new Exception('The registry cannot be created!<br />' . $sMessage);
         }
     } catch (Exception $oError) {
         $oConnection->rollback();
         throw $oError;
     }
 }
예제 #22
0
 function find($criteria = null, $order = null, $limit = 1000, $from = 0)
 {
     $result = $this->database->query($this->buildFindQuery($criteria, $order, $limit, $from));
     if (!is_null($result->getError())) {
         return $result->getError();
     }
     $stages = array();
     while ($row = $result->fetchRow()) {
         $stage = new Stage();
         $value = $row[0];
         $stage->setId($value);
         $value = $row[1];
         $stage->setPid($value);
         $value = $row[2];
         $stage->setName($value);
         $value = $row[3];
         $stage->setAbout($value);
         $value = $row[4];
         $stage->setOrderis($value);
         $value = $row[5];
         $value = $this->database->toBoolean($value);
         $stage->setLast($value);
         $value = $row[6];
         $stage->setPeriod_type($value);
         $value = $row[7];
         $stage->setPeriod($value);
         $value = $row[8];
         $stage->setDelay($value);
         $value = $row[9];
         $stage->setEnded_stage($value);
         $value = $row[10];
         $stage->setEnded_stage_pid($value);
         $value = $row[11];
         $stage->setCancel_customer($value);
         $value = $row[12];
         $stage->setCancel_customer_pid($value);
         $value = $row[13];
         $value = $this->database->toBoolean($value);
         $stage->setSend($value);
         $value = $row[14];
         $stage->setApi($value);
         $value = $row[15];
         $stage->setCampaign($value);
         $value = $row[16];
         $value = $this->database->toBoolean($value);
         $stage->setSend_mail($value);
         $value = $row[17];
         $stage->setSend_to($value);
         $value = $row[18];
         $stage->setSend_from($value);
         $value = $row[19];
         $stage->setSend_subject($value);
         $value = $row[20];
         $stage->setSend_text($value);
         $value = $row[21];
         $stage->setR_date($value);
         $value = $row[22];
         $stage->setR_user($value);
         if ($order != null) {
             array_push($stages, $stage);
         } else {
             $stages[$stage->getId()] = $stage;
         }
     }
     return $stages;
 }
예제 #23
0
파일: Types.php 프로젝트: Leolh/hive
 public function read($input)
 {
     $xfer = 0;
     $fname = null;
     $ftype = 0;
     $fid = 0;
     $xfer += $input->readStructBegin($fname);
     while (true) {
         $xfer += $input->readFieldBegin($fname, $ftype, $fid);
         if ($ftype == TType::STOP) {
             break;
         }
         switch ($fid) {
             case 1:
                 if ($ftype == TType::STRING) {
                     $xfer += $input->readString($this->queryId);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 2:
                 if ($ftype == TType::STRING) {
                     $xfer += $input->readString($this->queryType);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 3:
                 if ($ftype == TType::MAP) {
                     $this->queryAttributes = array();
                     $_size89 = 0;
                     $_ktype90 = 0;
                     $_vtype91 = 0;
                     $xfer += $input->readMapBegin($_ktype90, $_vtype91, $_size89);
                     for ($_i93 = 0; $_i93 < $_size89; ++$_i93) {
                         $key94 = '';
                         $val95 = '';
                         $xfer += $input->readString($key94);
                         $xfer += $input->readString($val95);
                         $this->queryAttributes[$key94] = $val95;
                     }
                     $xfer += $input->readMapEnd();
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 4:
                 if ($ftype == TType::MAP) {
                     $this->queryCounters = array();
                     $_size96 = 0;
                     $_ktype97 = 0;
                     $_vtype98 = 0;
                     $xfer += $input->readMapBegin($_ktype97, $_vtype98, $_size96);
                     for ($_i100 = 0; $_i100 < $_size96; ++$_i100) {
                         $key101 = '';
                         $val102 = 0;
                         $xfer += $input->readString($key101);
                         $xfer += $input->readI64($val102);
                         $this->queryCounters[$key101] = $val102;
                     }
                     $xfer += $input->readMapEnd();
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 5:
                 if ($ftype == TType::STRUCT) {
                     $this->stageGraph = new \Graph();
                     $xfer += $this->stageGraph->read($input);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 6:
                 if ($ftype == TType::LST) {
                     $this->stageList = array();
                     $_size103 = 0;
                     $_etype106 = 0;
                     $xfer += $input->readListBegin($_etype106, $_size103);
                     for ($_i107 = 0; $_i107 < $_size103; ++$_i107) {
                         $elem108 = null;
                         $elem108 = new \Stage();
                         $xfer += $elem108->read($input);
                         $this->stageList[] = $elem108;
                     }
                     $xfer += $input->readListEnd();
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 7:
                 if ($ftype == TType::BOOL) {
                     $xfer += $input->readBool($this->done);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 8:
                 if ($ftype == TType::BOOL) {
                     $xfer += $input->readBool($this->started);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             default:
                 $xfer += $input->skip($ftype);
                 break;
         }
         $xfer += $input->readFieldEnd();
     }
     $xfer += $input->readStructEnd();
     return $xfer;
 }
예제 #24
0
include_once 'init.inc.php';
if (isset($_REQUEST['id'])) {
    $p = new webpage("Iut Stage");
    $p->appendToHead(<<<head
\t    <meta charset="utf-8">
\t    <meta http-equiv="X-UA-Compatible" content="IE=edge">
\t    <meta name="viewport" content="width=device-width, initial-scale=1">
\t    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
\t    <meta name="description" content="">
\t    <meta name="author" content="">
head
);
    $p->appendCssUrl("style/bootstrap-3.3.5-dist/css/bootstrap.min.css");
    //inclusion de la barre de navigation
    include_once "navbar.inc.php";
    $stage = Stage::creatFromId($_REQUEST['id']);
    $entreprise = Entreprise::creatFromId($stage->getEntreprise());
    $titre = htmlspecialchars($stage->getTitre());
    $nbPoste = htmlspecialchars($stage->getNbPoste());
    $dateCreation = htmlspecialchars($stage->getDateCreation());
    $ref = htmlspecialchars($stage->getId());
    $nom = htmlspecialchars($entreprise->getNom());
    $adresse = htmlspecialchars($entreprise->getAdresse());
    $tel = htmlspecialchars($entreprise->getTel());
    $description = nl2br(htmlspecialchars($stage->getDescription()));
    $codePostal = htmlspecialchars($entreprise->getCodePostal());
    $adresse = htmlspecialchars($entreprise->getAdresse());
    $ville = htmlspecialchars($entreprise->getVille());
    $dateFin = htmlspecialchars($stage->getDateFin());
    $dateDebut = htmlspecialchars($stage->getDateDebut());
    $gratification = htmlspecialchars($stage->getGratification());
예제 #25
0
    /**
     * Retourne la liste, formatée en HTML (tableau) des stages de l'entreprise, en attente de validation (enseignant, étudiant ou entreprise)
     * @return HTML
     */
    public function listeStagesAttente()
    {
        $res = <<<HTML
    <table>
        <thead>
          <tr>
            <th>Offre</th>
            <th>Etudiant</th>
            <th>Enseignant</th>
            <th>Réponse Entreprise</th>
            <th>Réponse Enseignant</th>
            <th>Réponse Etudiant</th>
            <th>Action</th>
          </tr>
        </thead>
        <tbody>

HTML;
        $pdo = myPDO::getInstance();
        foreach ($this->offresProposees as $offre) {
            $stmt = $pdo->prepare(<<<SQL
      SELECT idEtu, idEns, idOffre
      FROM STAGE
      WHERE idOffre = :idOffre
      AND (acceptEns = 0
      OR acceptEtu = 0
      OR acceptEnt = 0)
SQL
);
            $stmt->execute(array("idOffre" => $offre->getID()));
            while (($ligne = $stmt->fetch()) !== false) {
                $stage = Stage::createFromIDs($ligne["idEtu"], $offre->getID(), $ligne["idEns"]);
                if ($stage->getAcceptEnt() == 0) {
                    $typeAction = "accepter";
                } else {
                    $typeAction = "refuser";
                }
                $res .= $stage->toHTML($typeAction);
            }
        }
        return $res . "</tbody></table>";
    }
예제 #26
0
    /**

     * this function remove all Process except the PROCESS ROW

     *

     * @param string $sProUid

     * @return boolean

     */

    public function removeProcessRows ($sProUid)

    {

        try {

            //Instance all classes necesaries

            $oProcess = new Process();

            $oDynaform = new Dynaform();

            $oInputDocument = new InputDocument();

            $oOutputDocument = new OutputDocument();

            $oTrigger = new Triggers();

            $oStepTrigger = new StepTrigger();

            $oRoute = new Route();

            $oStep = new Step();

            $oSubProcess = new SubProcess();

            $oCaseTracker = new CaseTracker();

            $oCaseTrackerObject = new CaseTrackerObject();

            $oObjectPermission = new ObjectPermission();

            $oSwimlaneElement = new SwimlanesElements();

            $oConnection = new DbSource();

            $oStage = new Stage();

            $oEvent = new Event();

            $oCaseScheduler = new CaseScheduler();

            $oConfig = new Configuration();



            //Delete the tasks of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( TaskPeer::PRO_UID, $sProUid );

            $oDataset = TaskPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            $oTask = new Task();

            while ($aRow = $oDataset->getRow()) {

                $oCriteria = new Criteria( 'workflow' );

                $oCriteria->add( StepTriggerPeer::TAS_UID, $aRow['TAS_UID'] );

                StepTriggerPeer::doDelete( $oCriteria );

                if ($oTask->taskExists( $aRow['TAS_UID'] )) {

                    $oTask->remove( $aRow['TAS_UID'] );

                }

                $oDataset->next();

            }



            //Delete the dynaforms of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( DynaformPeer::PRO_UID, $sProUid );

            $oDataset = DynaformPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                $sWildcard = PATH_DYNAFORM . $aRow['PRO_UID'] . PATH_SEP . $aRow['DYN_UID'] . '_tmp*';

                foreach (glob( $sWildcard ) as $fn) {

                    @unlink( $fn );

                }

                $sWildcard = PATH_DYNAFORM . $aRow['PRO_UID'] . PATH_SEP . $aRow['DYN_UID'] . '.*';

                foreach (glob( $sWildcard ) as $fn) {

                    @unlink( $fn );

                }

                if ($oDynaform->dynaformExists( $aRow['DYN_UID'] )) {

                    $oDynaform->remove( $aRow['DYN_UID'] );

                }

                $oDataset->next();

            }



            //Delete the input documents of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( InputDocumentPeer::PRO_UID, $sProUid );

            $oDataset = InputDocumentPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oInputDocument->InputExists( $aRow['INP_DOC_UID'] )) {

                    $oInputDocument->remove( $aRow['INP_DOC_UID'] );

                }

                $oDataset->next();

            }



            //Delete the output documents of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( OutputDocumentPeer::PRO_UID, $sProUid );

            $oDataset = OutputDocumentPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oOutputDocument->OutputExists( $aRow['OUT_DOC_UID'] )) {

                    $oOutputDocument->remove( $aRow['OUT_DOC_UID'] );

                }

                $oDataset->next();

            }



            //Delete the steps

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( StepPeer::PRO_UID, $sProUid );

            $oDataset = StepPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                //Delete the steptrigger of process

                /*$oCriteria = new Criteria('workflow');

                  $oCriteria->add(StepTriggerPeer::STEP_UID, $aRow['STEP_UID']);

                  $oDataseti = StepTriggerPeer::doSelectRS($oCriteria);

                  $oDataseti->setFetchmode(ResultSet::FETCHMODE_ASSOC);

                  $oDataseti->next();

                  while ($aRowi = $oDataseti->getRow()) {

                  if ($oStepTrigger->stepTriggerExists($aRowi['STEP_UID'], $aRowi['TAS_UID'], $aRowi['TRI_UID'], $aRowi['ST_TYPE']))

                  $oStepTrigger->remove($aRowi['STEP_UID'], $aRowi['TAS_UID'], $aRowi['TRI_UID'], $aRowi['ST_TYPE']);

                  $oDataseti->next();

                  }*/

                $oStep->remove( $aRow['STEP_UID'] );

                $oDataset->next();

            }



            //Delete the StepSupervisor

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( StepSupervisorPeer::PRO_UID, $sProUid );

            $oDataset = StepSupervisorPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oStep->StepExists( $aRow['STEP_UID'] )) {

                    $oStep->remove( $aRow['STEP_UID'] );

                }

                $oDataset->next();

            }



            //Delete the triggers of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( TriggersPeer::PRO_UID, $sProUid );

            $oDataset = TriggersPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oTrigger->TriggerExists( $aRow['TRI_UID'] )) {

                    $oTrigger->remove( $aRow['TRI_UID'] );

                }

                $oDataset->next();

            }

            //Delete the routes of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( RoutePeer::PRO_UID, $sProUid );

            $oDataset = RoutePeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oRoute->routeExists( $aRow['ROU_UID'] )) {

                    $oRoute->remove( $aRow['ROU_UID'] );

                }

                $oDataset->next();

            }

            //Delete the swimlanes elements of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( SwimlanesElementsPeer::PRO_UID, $sProUid );

            $oDataset = SwimlanesElementsPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oSwimlaneElement->swimlanesElementsExists( $aRow['SWI_UID'] )) {

                    $oSwimlaneElement->remove( $aRow['SWI_UID'] );

                }

                $oDataset->next();

            }



            //Delete the DB connections of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( DbSourcePeer::PRO_UID, $sProUid );

            $oDataset = DbSourcePeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oConnection->Exists( $aRow['DBS_UID'], $aRow['PRO_UID'] )) {

                    $oConnection->remove( $aRow['DBS_UID'], $aRow['PRO_UID'] );

                }

                $oDataset->next();

            }



            //Delete the sub process of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( SubProcessPeer::PRO_PARENT, $sProUid );

            $oDataset = SubProcessPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oSubProcess->subProcessExists( $aRow['SP_UID'] )) {

                    $oSubProcess->remove( $aRow['SP_UID'] );

                }

                $oDataset->next();

            }



            //Delete the caseTracker of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( CaseTrackerPeer::PRO_UID, $sProUid );

            $oDataset = CaseTrackerPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oCaseTracker->caseTrackerExists( $aRow['PRO_UID'] )) {

                    $oCaseTracker->remove( $aRow['PRO_UID'] );

                }

                $oDataset->next();

            }



            //Delete the caseTrackerObject of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( CaseTrackerObjectPeer::PRO_UID, $sProUid );

            $oDataset = CaseTrackerObjectPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oCaseTrackerObject->caseTrackerObjectExists( $aRow['CTO_UID'] )) {

                    $oCaseTrackerObject->remove( $aRow['CTO_UID'] );

                }

                $oDataset->next();

            }



            //Delete the ObjectPermission of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( ObjectPermissionPeer::PRO_UID, $sProUid );

            $oDataset = ObjectPermissionPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oObjectPermission->Exists( $aRow['OP_UID'] )) {

                    $oObjectPermission->remove( $aRow['OP_UID'] );

                }

                $oDataset->next();

            }



            //Delete the Stage of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( StagePeer::PRO_UID, $sProUid );

            $oDataset = StagePeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oStage->Exists( $aRow['STG_UID'] )) {

                    $oStage->remove( $aRow['STG_UID'] );

                }

                $oDataset->next();

            }



            //Delete the Event of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( EventPeer::PRO_UID, $sProUid );

            $oDataset = EventPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oEvent->Exists( $aRow['EVN_UID'] )) {

                    $oEvent->remove( $aRow['EVN_UID'] );

                }

                $oDataset->next();

                if ($oEvent->existsByTaskUidFrom( $aRow['TAS_UID'] )) {

                    $aRowEvent = $oEvent->getRowByTaskUidFrom( $aRow['TAS_UID'] );

                    $oEvent->remove( $aRowEvent['EVN_UID'] );

                }

                $oDataset->next();

            }



            //Delete the CaseScheduler of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( CaseSchedulerPeer::PRO_UID, $sProUid );

            $oDataset = CaseSchedulerPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oCaseScheduler->Exists( $aRow['SCH_UID'] )) {

                    $oCaseScheduler->remove( $aRow['SCH_UID'] );

                }

                $oDataset->next();

            }



            //Delete the TaskExtraProperties of the process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->addSelectColumn( ConfigurationPeer::CFG_UID );

            $oCriteria->addSelectColumn( ConfigurationPeer::OBJ_UID );

            $oCriteria->addSelectColumn( ConfigurationPeer::CFG_VALUE );

            $oCriteria->addSelectColumn( TaskPeer::PRO_UID );

            $oCriteria->addSelectColumn( ConfigurationPeer::USR_UID );

            $oCriteria->addSelectColumn( ConfigurationPeer::APP_UID );

            $oCriteria->add( TaskPeer::PRO_UID, $sProUid );

            $oCriteria->add( ConfigurationPeer::CFG_UID, 'TAS_EXTRA_PROPERTIES' );

            $oCriteria->addJoin( ConfigurationPeer::OBJ_UID, TaskPeer::TAS_UID );

            $oDataset = ConfigurationPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oConfig->exists($aRow['CFG_UID'], $aRow['OBJ_UID'], $aRow['PRO_UID'], $aRow['USR_UID'], $aRow['APP_UID'])) {

                    $oConfig->remove( $aRow['CFG_UID'], $aRow['OBJ_UID'], $aRow['PRO_UID'], $aRow['USR_UID'], $aRow['APP_UID'] );

                }

                $oDataset->next();

            }



            return true;

        } catch (Exception $oError) {

            throw ($oError);

        }

    }
 /**
  * Remove the specified resource from storage.
  * DELETE /projectstages/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $stage = Stage::find($id)->delete();
     if (is_null($stage)) {
         $class = 'error';
         $message = 'Record does not exist.';
     } else {
         $class = 'success';
         $message = 'Record successfully deleted.';
     }
     return Redirect::route('project.stage.index')->with('class', $class)->with('message', $message);
 }
예제 #28
0
 /**
  * @see http://symphony-cms.com/learn/api/2.2/toolkit/extension/#update
  */
 public function update($previousVersion)
 {
     $status = array();
     // Prior version 2.0
     if (version_compare($previousVersion, '2.0', '<')) {
         // Update existing entries
         $fields = Symphony::Database()->fetchCol("field_id", "SELECT `field_id` from `tbl_fields_datetime`");
         foreach ($fields as $field) {
             // New database schema
             $status[] = Symphony::Database()->query("ALTER TABLE `tbl_entries_data_{$field}`\n\t\t\t\t\t\t MODIFY `start` datetime NOT NULL,\n\t\t\t\t\t\t MODIFY `end` datetime NOT NULL");
             // Don't allow empty end dates
             $status[] = Symphony::Database()->query("UPDATE `tbl_entries_data_{$field}`\n\t\t\t\t\t\t SET `end` = `start`\n\t\t\t\t\t\t WHERE `end` = 'none'\n\t\t\t\t\t\t OR `end` = '0000-00-00 00:00'");
         }
         // Get table columns
         $columns = Symphony::Database()->fetchCol('Field', "SHOW COLUMNS FROM `tbl_fields_datetime`");
         // Remove allow multiple setting
         if (in_array('allow_multiple_dates', $columns)) {
             $status[] = Symphony::Database()->query("ALTER TABLE `tbl_fields_datetime` DROP `allow_multiple_dates`");
         }
         // Add time setting
         if (!in_array('time', $columns)) {
             $status[] = Symphony::Database()->query("ALTER TABLE `tbl_fields_datetime` ADD `time` tinyint(1) DEFAULT '1'");
         }
         // Add range setting
         if (!in_array('range', $columns)) {
             $status[] = Symphony::Database()->query("ALTER TABLE `tbl_fields_datetime` ADD `range` tinyint(1) DEFAULT '1'");
         }
         // Modify prepopulation setting
         $status[] = Symphony::Database()->query("ALTER TABLE `tbl_fields_datetime` MODIFY `prepopulate` tinyint(1) DEFAULT '1'");
         // Correctly store old 'no' values
         $status[] = Symphony::Database()->query("UPDATE tbl_fields_datetime\n\t\t\t\t\t SET `prepopulate` = 0 WHERE `prepopulate` > 1");
         // Create stage
         $status[] = Stage::install();
     }
     // Prior version 2.4
     if (version_compare($previousVersion, '2.4', '<')) {
         // Move language codes to configuration
         Symphony::Configuration()->set('english', $this->languages['english'], 'datetime');
         Symphony::Configuration()->set('german', $this->languages['german'], 'datetime');
         Administration::instance()->saveConfig();
     }
     // Report status
     if (in_array(false, $status, true)) {
         return false;
     } else {
         return true;
     }
 }
예제 #29
0
파일: index.php 프로젝트: riaf/concert
<?php

require dirname(__FILE__) . '/__init__.php';
Rhaco::import('generic.Urls');
Rhaco::import('model.Stage');
$db = new DbUtil(Stage::connection());
$pattern = array('^upload$' => array('class' => 'ConcertView', 'method' => 'upload'), '^play/(\\d+)$' => array('class' => 'ConcertView', 'method' => 'play'), '^$' => array('class' => 'ConcertView', 'method' => 'index'));
$parser = Urls::parser($pattern, $db);
$parser->write();