The base class for most "grimas".
More...
|
| static |
RunIt () |
| |
| static |
call ($grimaname, $args=array()) |
| |
The base class for most "grimas".
Definition at line 1306 of file grima-lib.php.
◆ __construct()
| GrimaTask::__construct |
( |
|
) |
|
Definition at line 1332 of file grima-lib.php.
References join_paths().
1334 $base = get_class($this);
1335 if (file_exists(
join_paths($webroot,$base,
"$base.xml")) and (!isset($this->formxml))) {
1336 $this->formxml = file_get_contents(
join_paths($webroot,$base,
"$base.xml"));
1338 if (isset($this->formxml)) {
1340 $this->form->fromXML($this->formxml);
◆ addMessage()
| GrimaTask::addMessage |
( |
|
$type, |
|
|
|
$message |
|
) |
|
|
Definition at line 1396 of file grima-lib.php.
A thin wrapper around a message and urgency level.
◆ call()
| static GrimaTask::call |
( |
|
$grimaname, |
|
|
|
$args = array() |
|
) |
|
|
|
static |
◆ check_input()
| GrimaTask::check_input |
( |
|
) |
|
Definition at line 1457 of file grima-lib.php.
1458 if (isset($this->form)) {
1460 foreach ($this->form->fields as $field) {
1461 if ($field->required) {
1462 if (!isset($this[$field->name]) or
1463 !($this[$field->name])) {
1464 $field->error_condition =
"error";
1465 $field->error_message =
"Field is required\n";
1466 $input_good =
false;
1473 foreach ($this->auto_args as $k => $v) {
1474 if (preg_match(
'/[^:]:$/',$k)) {
1475 if (!isset($this->args[$v]) or !($this->args[$v])) {
◆ check_login()
| GrimaTask::check_login |
( |
|
) |
|
Definition at line 1384 of file grima-lib.php.
References $grima, and call().
1386 if (isset($grima->apikey) and isset($grima->server) and
1387 ($grima->apikey) and ($grima->server)) {
static call($grimaname, $args=array())
◆ do_task()
◆ get_input()
Definition at line 1428 of file grima-lib.php.
1429 if (isset($this->form)) {
1430 if (php_sapi_name() ==
"cli") { # command line
1444 foreach ($this->form->fields as $field) {
1445 if (isset($_REQUEST[$field->name])) {
1446 $this[$field->name] = $_REQUEST[$field->name];
◆ get_input_param()
| GrimaTask::get_input_param |
( |
|
$param |
) |
|
Definition at line 1484 of file grima-lib.php.
1485 if (php_sapi_name() ==
"cli") { # command line
1486 if ($options = getopt(implode(array_keys($param)))) {
1487 foreach ($param as $k => $v) {
1488 $this->args[$v] = $options[$k[0]];
1491 $this->
usage(); exit;
1494 $this->
usage(); exit;
1497 foreach ($param as $k => $v) {
1498 if (isset($_REQUEST[$v])) {
1499 $this->args[$v] = $_REQUEST[$v];
◆ offsetExists()
| GrimaTask::offsetExists |
( |
|
$offset |
) |
|
Definition at line 1316 of file grima-lib.php.
1317 return isset($this->args[$offset]);
◆ offsetGet()
| GrimaTask::offsetGet |
( |
|
$offset |
) |
|
◆ offsetSet()
| GrimaTask::offsetSet |
( |
|
$offset, |
|
|
|
$value |
|
) |
|
|
◆ offsetUnset()
| GrimaTask::offsetUnset |
( |
|
$offset |
) |
|
◆ print_failure()
| GrimaTask::print_failure |
( |
|
) |
|
Definition at line 1379 of file grima-lib.php.
1380 $this->form->loadValues($this);
1381 $this->splat->splat(
'print_failure', $this->splatVars );
◆ print_form()
| GrimaTask::print_form |
( |
|
) |
|
Definition at line 1369 of file grima-lib.php.
1370 $this->form->loadValues($this);
1371 $this->splat->splat(
'print_form', $this->splatVars );
◆ print_success()
| GrimaTask::print_success |
( |
|
) |
|
Definition at line 1374 of file grima-lib.php.
1375 $this->form->loadPersistentValues($this);
1376 $this->splat->splat(
'print_success', $this->splatVars );
◆ run()
Definition at line 1400 of file grima-lib.php.
1401 $this->
check_login(); #
if not logged in, print login form
1402 $this->error =
false;
1408 }
catch (Exception $e) {
1410 $this->error =
true;
addMessage($type, $message)
◆ RunIt()
| static GrimaTask::RunIt |
( |
|
) |
|
|
static |
◆ setup_splat()
| GrimaTask::setup_splat |
( |
|
) |
|
Definition at line 1344 of file grima-lib.php.
1346 $basename = get_class($this);
1350 $this->splat->addBases(array(
1351 "$webroot/$basename/splats",
1355 $this->splatVars = array(
1356 'title' => $this->form->title,
1357 'basename' => $basename,
1358 'webroot' => $webroot,
1359 'local_stylesheets' => array(
'Grima.css'),
1360 'form' => &$this->form,
1361 'messages' => &$this->messages,
1364 if (isset($this[
'redirect_url'])) {
1365 $this->splatVars[
'redirect_url'] = $this[
'redirect_url'];
◆ usage()
Definition at line 1510 of file grima-lib.php.
1510 { # XXX rewrite
for grima form
1512 print
"Usage: php ${argv[0]} ";
1513 foreach ($this->auto_args as $k => $v) {
1514 if (preg_match(
'/^(.):$/',$k,$m)) {
1515 print
"-${m[1]} <$v> ";
1517 if (preg_match(
'/^(.)::$/',$k,$m)) {
1518 print
"[ -${m[1]} <$v> ] ";
1520 if (preg_match(
'/^.$/',$k)) {
◆ $args
| GrimaTask::$args = array() |
◆ $auto_args
| GrimaTask::$auto_args = array() |
◆ $el_override
| GrimaTask::$el_override = array() |
◆ $error
| GrimaTask::$error = false |
◆ $messages
| GrimaTask::$messages = array() |
The documentation for this class was generated from the following file: