本文整理汇总了PHP中ClassRegistry::Init方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassRegistry::Init方法的具体用法?PHP ClassRegistry::Init怎么用?PHP ClassRegistry::Init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClassRegistry
的用法示例。
在下文中一共展示了ClassRegistry::Init方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$accreditation_types = ClassRegistry::Init('Eventure.AccreditationType')->find('all');
$events = ClassRegistry::Init('Eventure.Event')->find('all');
$data = $this->paginate();
foreach ($data as $k => $v) {
$data[$k]['Attendee'] = get_as_obj(ClassRegistry::init('Eventure.Attendee')->findById($v['Checkin']['attendee_id']), 'Attendee');
$acc = get_as_obj(ClassRegistry::init('Eventure.Accreditation')->findById($v['Checkin']['accreditation_id']), 'Accreditation');
$data[$k]['Accreditation'] = $acc;
}
//
$this->set(compact('data', 'events', 'accreditation_types', 'attendees'));
}
示例2: view
public function view($id = null)
{
// Find all accreditations for this event
$acc = ClassRegistry::Init('Eventure.Accreditation')->findAllByEventId($id);
$m = ClassRegistry::init('Eventure.Accreditation');
foreach ($acc as &$a) {
$a['Attendees'] = ClassRegistry::Init('Eventure.AttendeesAccreditation')->findAllByAccreditationId($a['Accreditation']['id']);
}
$total_attendees = $total_checkins = 0;
foreach ($acc as $x) {
$total_attendees += sizeof($x['Attendees']);
$total_checkins += sizeof($x['Checkin']);
}
$event = $this->Event->read(null, $id);
$all_accreditations = $m->find('all');
$this->set(compact('event', 'acc', 'total_attendees', 'total_checkins', 'all_accreditations'));
}
示例3: __call
/**
* __call method
*
* @param mixed $method Method Called.
* @param mixed $params Passed Parameters.
*
* @return boolean
*/
function __call($method, $params)
{
if (!empty($params[0]) && ($model = ClassRegistry::Init($params[0]))) {
if (is_callable(array($model, $method))) {
unset($params[0]);
return call_user_func_array(array($model, $method), $params);
}
}
return false;
}
示例4: ShareYahoo
function ShareYahoo($text, $userID, $linktext, $linkurl)
{
App::import('Vendor', 'Yahoo', array('file' => 'yahoo/Yahoo.inc'));
$Setting = ClassRegistry::Init("Setting");
$settings = $Setting->find('first');
$settings = $settings['Setting'];
$hasSession = YahooSession::hasSession($settings['yahoo_consumer_key'], $settings['yahoo_consumer_secret'], $settings['yahoo_app_id']);
if ($hasSession != FALSE) {
$session = YahooSession::requireSession($settings['yahoo_consumer_key'], $settings['yahoo_consumer_secret'], $settings['yahoo_app_id']);
$user = $session->getSessionedUser();
// create an unique hash of the update data using md5
$suid = md5($text . $linktext . $linkurl . time());
// insert the update...
$user->insertUpdate($suid, $text, $linkurl, $linktext);
return true;
}
return false;
}
示例5: ResizeImageContentCloud
function ResizeImageContentCloud($source, $destination_path, $model_id, $model_name, $type = "original", $mime_type, $width, $height, $resizeType = 'cropResize')
{
$ext = pathinfo($source, PATHINFO_EXTENSION);
$Content = ClassRegistry::Init("Content");
$data = $Content->find("first", array("conditions" => array("Content.model_id" => $model_id, "Content.model" => $model_name, "LOWER(Content.type)" => strtolower($type))));
if (!empty($data)) {
$Contents["Content"]["id"] = $data["Content"]["id"];
}
$Contents["Content"]["model"] = $model_name;
$Contents["Content"]["model_id"] = $model_id;
$Contents["Content"]["host"] = $this->awsHost;
$Contents["Content"]["mime_type"] = $mime_type;
$Contents["Content"]["cloud"] = "1";
App::import('Vendor', 'upload', array('file' => 'class.upload.php'));
$img = new upload($source);
$img->file_new_name_body = $model_id . "_" . $type;
if ($resizeType == 'cropResize') {
$img->image_resize = true;
$img->image_ratio_crop = true;
$img->image_y = $height;
$img->image_x = $width;
} else {
if ($resizeType == 'resizeMaxWidth') {
$img->image_resize = true;
$img->image_ratio_y = true;
$img->image_x = $width;
}
}
$img->process($destination_path);
$Contents["Content"]["type"] = $type;
$Contents["Content"]["url"] = "contents/{$model_name}/{$model_id}/{$model_id}_{$type}.{$ext}";
$Contents["Content"]["path"] = "contents/{$model_name}/{$model_id}/{$model_id}_{$type}.{$ext}";
if ($img->processed) {
$file_source = $destination_path . $model_id . "_" . $type . "." . $ext;
if ($this->UploadToCloud($file_source, $model_id, $model_name, $type, $mime_type, $ext)) {
unlink($file_source);
$Content->create();
$Content->save($Contents);
return true;
} else {
return false;
}
} else {
return false;
}
}