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); }