예제 #1
0
See the License for the specific language governing permissions and
limitations under the License.
*/
$page = 'mydiagrams';
require_once dirname(__FILE__) . '/common/delegate.php';
if (!isset($_SESSION)) {
    session_start();
}
require_once dirname(__FILE__) . '/common/rememberme.php';
if (!isset($_SESSION['userId']) || !is_numeric($_SESSION['userId'])) {
    addError("Access denied");
    redirect('./editor.php');
}
$delegate = new Delegate();
$loggedUser = $delegate->userGetById($_SESSION['userId']);
$allDiagrams = $delegate->diagramGetAll();
/**Exctracts the name of an email address*/
function firstName($email)
{
    $rez = strpos($email, '@');
    if ($rez) {
        return substr($email, 0, $rez);
    } else {
        return substr($email, 0, 5);
    }
}
?>

<!DOCTYPE html>
<html>
    <!--Copyright 2010 Scriptoid s.r.l-->
예제 #2
0
        }
    }
    return $diagrams;
}
function diagramDeleteById($dbhandle, $diagramId)
{
    $query = sprintf("delete FROM diagram where id=%d", $diagramId);
    $result = sqlite_query($dbhandle, $query);
    if ($result) {
    }
}
if (false && PHP_SAPI == 'cli') {
    //see http://php.net/manual/en/features.commandline.php
    print "\nOn the console";
    //test
    $d = new Delegate();
    $diagrams = $d->diagramGetAll();
    print_r($diagrams);
    $diagram = new Diagram();
    $diagram->title = 'Ana are mere';
    $diagram->description = 'Ana are foarte multe mere';
    $diagram->public = 0;
    $diagram->createdDate = gmdate('Y-m-d h:i:s');
    $diagram->lastUpdate = gmdate('Y-m-d h:i:s');
    $dId = $d->diagramCreate($diagram);
    print "Diagram Id: " + $dId;
    $nd = $d->diagramGetById($dId);
    $nd->title = 'Zzoz';
    $d->diagramUpdate($nd);
    $d->close();
}