Software:Sansa Framework
Please use PROD only on articles. It is proposed that this article be deleted because of the following concern:
If you can address this concern by improving, copyediting, sourcing, renaming, or merging the page, please edit this page and do so. You may remove this message if you improve the article or otherwise object to deletion for any reason. Although not required, you are encouraged to explain why you object to the deletion, either in your edit summary or on the talk page. If this template is removed, do not replace it. This message has remained in place for seven days, so the article may be deleted without further notice. Timestamp: 20240620144953 14:49, 20 June 2024 (UTC) Administrators: delete |
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)
(Learn how and when to remove this template message)No issues specified. Please specify issues, or remove this template. |
Sansa Framework is a structure to create PHP web applications using the model–view–controller (MVC) model, it's a web application that must be installed in a server to work, could be installed in a test server or in production server. The developer must create a data model and do all the changes the project need and at any time generate the model. The generation creates a database in MySQL server with the same name of the model and a n-tier layer of libraries to handle the database.
To insert a new record to the table, create a new instance of a class, fill the properties and call the insert method.
$usr = new users(); $usr->name = "test"; $usr->insert();
The code above insert one record to the table users with the name test.
$usr = new users(); if ($usr->get("name")->where("id=1")->exe()) { if ($usr->count > 0) { foreach ($usr->dobj as $d) { echo $d->name . "<br>"; } } }
The code above print test.
$usr = new users(1); echo $usr->name;
The code above print test too.
Complex code:
public function save($arr) { $result = false; $this->arr_to_prop($arr); //this method clear the array of risky code and //assign $this->name = $arr['mappname'] and any other property. $index = $arr['index']; if ($index == 0) { // new $result = $this->insert(); } else { // edit if (isset($_SESSION['dusers'])) { $id = $_SESSION['dusers'][$index]['id'] $result = $this->update($id); } } return $result; }
The code below shows how to create joins.
require($_SERVER['DOCUMENT_ROOT'] . '/layers/bll/users.php'); require($_SERVER['DOCUMENT_ROOT'] . '/layers/bll/rights.php'); require($_SERVER['DOCUMENT_ROOT'] . '/layers/bll/access.php'); $u = new users(); if ($u->join($r = new rights())->on(array($u->rightid(), EQUAL, $r->id())) ->join($a = new access())->on(array($r->idaccess(), EQUAL, $a->aid())) ->get(array($u->name(), $r->rname(), $a->aname())) ->exe()) { // echo $u->sqlstr . "<br><br>"; // print the resulting sql if you need it. foreach ($u->dobj as $d) { echo $d->name . " " . $d->rname . " " . $d->aname . "<br>"; } }
External links
Original source: https://en.wikipedia.org/wiki/Sansa Framework.
Read more |