Initial import of tasks application
This initial import is a heavily modified version of the code I had here, as Arse was modified for other purposes in the meantime and the application no longer worked with it. In addition: * I did not import the user management part yet, * task dependencies are supported in-base, but there is no interface for that yet.
This commit is contained in:
commit
9677ad4dd3
36 changed files with 3919 additions and 0 deletions
includes/t-items
44
includes/t-items/fields.inc.php
Normal file
44
includes/t-items/fields.inc.php
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
|
||||
class Item_LocationField
|
||||
implements FieldValidator , FieldModifier
|
||||
{
|
||||
|
||||
private $okLocations;
|
||||
|
||||
public function __construct( $okLocations )
|
||||
{
|
||||
$this->okLocations = $okLocations;
|
||||
}
|
||||
|
||||
public function replace( $value )
|
||||
{
|
||||
$exploded = explode( ':' , $value );
|
||||
if ( count( $exploded ) != 2 ) {
|
||||
$exploded = array( 0 , $value );
|
||||
}
|
||||
|
||||
if ( $exploded[ 1 ] == '' ) {
|
||||
$exploded[ 0 ] = 1;
|
||||
} else {
|
||||
$exploded[ 0 ] = ( $exploded[ 0 ] == '0' ) ? 0 : 1;
|
||||
$exploded[ 1 ] = (int) $exploded[ 1 ];
|
||||
}
|
||||
|
||||
return join( ':' , $exploded );
|
||||
}
|
||||
|
||||
public function validate( $value )
|
||||
{
|
||||
list( $inside , $before ) = explode( ':' , $value );
|
||||
if ( $before != '' && Loader::DAO( 'items' )->get( $before ) == null ) {
|
||||
return array( 'This item no longer exists.' );
|
||||
}
|
||||
if ( ! ( empty( $this->okLocations ) || in_array( $value , $this->okLocations ) ) ) {
|
||||
return array( 'Invalid destination' );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue