Esempio n. 1
0
 private function _ConfModal($mode, $icon, $type, $action, $auth = false, $conf = false, $prompt = '', $cust = false)
 {
     $mod_id = substr(crc32(microtime()), 1, 6);
     if ($prompt == '') {
         $prompt = '<p>Are you sure you want to ' . $mode . ' the following ' . $type . ':</p>';
     }
     $mod_content = $prompt . PHP_EOL;
     $mod_content .= '<ul id="' . $mode . '_' . $type . '"></ul>' . PHP_EOL;
     $mod_form = new Form($mode . '_f', $action, 'post', 'application/x-www-form-urlencoded', $mode . '_' . $type . '(); return false;');
     $mod_form->setColumns(4, 8);
     $mod_form->addHiddenField($type, '', $type . '_to_' . $mode);
     if ($auth) {
         $mod_form->addPasswordField('Your Password', 'pwd', '', array('t' => 'Your password to confirm the operation', 'p' => 'Your Password'), array('t' => 'password', 'r' => true));
     }
     if ($conf) {
         $mod_form->addButtonGroup('Are you sure?', 'conf', array(array('i' => 'confY' . $mod_id, 's' => B_T_SUCCESS, 'v' => 1, 'l' => 'Yes', 'c' => false), array('i' => 'confN' . $mod_id, 's' => B_T_FAIL, 'v' => 0, 'l' => 'No', 'c' => true)), array('t' => 'Are you sure you wish to perform this action?'));
     }
     $mod_form->build();
     $mod_content .= $mod_form->getForm();
     $mod = new Modal();
     $mod->setID($mode);
     $mod->setTitle(ucfirst($mode) . ' ' . ucfirst($type) . '?');
     $mod->setBody($mod_content);
     $mod->setLeft('default', 'Cancel', 'remove-sign', 'button', '$(\'#' . $mode . '\').modal(\'hide\')');
     $mod->setRight('danger', 'OK', $icon, 'button', $mode . '_' . $type . '(this)');
     $mod->create();
     $this->comps[] = $mod->getModal();
     $this->_addConfModalScript($mode, $type, $cust);
 }
Esempio n. 2
0
        </div>
        <div class="col-sm-6">
          <button onClick="return openModal()" id="saveContBtn" class="btn btn-large btn-success btn-block" type="submit">Save Meet&nbsp;&nbsp;&nbsp;<span class="<?php 
print B_ICON . ' ' . B_ICON;
?>
-floppy-disk"></span></button>
        </div>
      </div>
      <?php 
$deleteConf = new Modal();
$deleteConf->setID('saveCont');
$deleteConf->setBody('Do you wish to save this meet and continue to add notes (continue wizard) or save this meet and return to the View Competitions page?');
$deleteConf->setTitle('Save?');
$deleteConf->setCentre('default', 'Save &amp; Close', 'floppy-disk', 'button', '$(\'#saveOpt\').val(\'back\');document.getElementById(\'comp_add\').submit();');
$deleteConf->setRight('success', 'Save &amp; Continue', 'floppy-save', 'submit', '$(\'#saveOpt\').val(\'cont\');');
print $deleteConf->getModal();
?>
      <input type="hidden" name="saveOpt" value="cont" id="saveOpt" />
    </form>
  </div>
</div>
<script type="text/javascript">
var completion = 0;
function openModal(){
	if(Spry.Widget.Form.validate(document.getElementById("comp_add"))){
		$("#saveCont").modal('show');
	}
	return false;
}
var title = new Spry.Widget.ValidationTextField("s_title", "none", {validateOn:["blur"]});
var licence = new Spry.Widget.ValidationTextField("s_licence", "none", {isRequired:false,validateOn:["blur"]});
    $delEvt = 2;
} else {
    $delEvt = 5;
}
$addEvt->setBody('<label>How many events do you wish to add?</label><input class="form-control" type="number" value="5" id="addNum"/>');
$addEvt->setTitle('Add Events');
$addEvt->setCentre(B_T_PRIMARY, 'Add One Event', 'plus-sign', 'button', 'addEvt(1)');
$addEvt->setRight(B_T_PRIMARY, 'Add Events', 'plus-sign', 'button', 'addEvt($(\'#addNum\').val())');
print $addEvt->getModal();
$addEvt = new Modal();
$addEvt->setID('delEvt');
$addEvt->setBody('<label>How many events do you wish to remove?</label><input class="form-control" type="number" value="' . $delEvt . '" id="delNum"/>');
$addEvt->setTitle('Remove Events');
$addEvt->setCentre(B_T_FAIL, 'Remove All Events', 'minus-sign', 'button', 'delEvt(' . $_GET['e'] . ')');
$addEvt->setRight(B_T_WARNING, 'Remove Event(s)', 'minus-sign', 'button', 'delEvt($(\'#delNum\').val())');
print $addEvt->getModal();
?>
      <input type="hidden" name="ID" value="<?php 
print $_GET['m'];
?>
"/>
      <input type="hidden" name="saveOpt" value="cont" id="saveOpt" />
    </form>
  </div>
</div>
<script type="text/javascript">
var completion = 0;
function openModal(){
	if(Spry.Widget.Form.validate(document.getElementById("comp_add"))){
		$("#saveCont").modal('show');
	}