本文整理汇总了PHP中Organization::getWhere方法的典型用法代码示例。如果您正苦于以下问题:PHP Organization::getWhere方法的具体用法?PHP Organization::getWhere怎么用?PHP Organization::getWhere使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Organization
的用法示例。
在下文中一共展示了Organization::getWhere方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run($insee = null)
{
$controller = $this->getController();
$where = array("address.codeInsee" => $insee);
$params["events"] = Event::getWhere($where);
$params["organizations"] = Organization::getWhere($where);
$params["people"] = Person::getWhere($where);
$controller->render("directory", $params);
}
示例2: actionExportInitData
/**
* Export all data related to a person
* Generates a json file
* and an image folder
*/
public function actionExportInitData($id, $module)
{
if (isset(Yii::app()->session["userId"]) && $id == Yii::app()->session["userId"]) {
$account = PHDB::findOne(PHType::TYPE_CITOYEN, array("_id" => new MongoId(Yii::app()->session["userId"])));
if ($account) {
/* **************************************
* SETUP FILE SYSTEM
***************************************** */
$suffixe = "";
//"_".date('YmdHi')
$base = 'upload' . DIRECTORY_SEPARATOR . 'export' . DIRECTORY_SEPARATOR . Yii::app()->session["userId"] . $suffixe . DIRECTORY_SEPARATOR;
$upload_dir = $base . "assets" . DIRECTORY_SEPARATOR;
if (!file_exists($upload_dir)) {
mkdir($upload_dir, 0775, true);
}
$upload_dir = $base;
$account["_id"] = array('$oid' => (string) $account["_id"]);
unset($account["_id"]['$id']);
/* **************************************
* CITOYENS MAP
***************************************** */
$exportInitData = array(PHType::TYPE_CITOYEN => array($account));
/* **************************************
* ORGANIZATIONS MAP
***************************************** */
$myOrganizations = Organization::getWhere(array("creator" => Yii::app()->session["userId"]));
if ($myOrganizations) {
$exportInitData[Organization::COLLECTION] = array();
foreach ($myOrganizations as $key => $o) {
array_push($exportInitData[Organization::COLLECTION], $o);
}
}
/* **************************************
* Events MAP
***************************************** */
$myEvents = Event::getWhere(array("creator" => Yii::app()->session["userId"]));
if ($myEvents) {
$exportInitData[Event::COLLECTION] = array();
foreach ($myEvents as $key => $e) {
array_push($exportInitData[Event::COLLECTION], $e);
}
}
/* **************************************
* Documents MAP
***************************************** */
$myDocs = Document::getWhere(array("creator" => Yii::app()->session["userId"]));
if ($myDocs) {
$exportInitData[Document::COLLECTION] = array();
foreach ($myDocs as $key => $doc) {
array_push($exportInitData[Document::COLLECTION], $doc);
$src = "upload" . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . $doc["type"] . DIRECTORY_SEPARATOR . $doc["id"] . DIRECTORY_SEPARATOR . $doc["name"];
$dest = $upload_dir . "assets" . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . $doc["folder"] . DIRECTORY_SEPARATOR . $doc["name"];
if (file_exists($src)) {
if (!file_exists($upload_dir . "assets" . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . $doc["folder"] . DIRECTORY_SEPARATOR)) {
mkdir($upload_dir . "assets" . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . $doc["folder"] . DIRECTORY_SEPARATOR, 0775, true);
}
copy($src, $dest);
}
}
}
$res = json_encode($exportInitData);
file_put_contents($upload_dir . Yii::app()->session["userId"] . ".json", $res, LOCK_EX);
echo "<a href='" . Yii::app()->createUrl("/" . $upload_dir . Yii::app()->session["userId"] . ".json") . "' target='_blank'>See your Exported data</a>";
} else {
echo Rest::json(array("result" => false, "msg" => "Cette requete ne peut aboutir."));
}
} else {
echo Rest::json(array("result" => false, "msg" => "Cette requete ne peut aboutir."));
}
}