当前位置: 首页>>代码示例>>PHP>>正文


PHP collection类代码示例

本文整理汇总了PHP中collection的典型用法代码示例。如果您正苦于以下问题:PHP collection类的具体用法?PHP collection怎么用?PHP collection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了collection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addStampConf

    private function addStampConf(\collection $coll)
    {
        $domprefs = new DOMDocument();
        $domprefs->loadXML($coll->get_prefs());
        $prefs = '<?xml version="1.0" encoding="UTF-8"?>
<baseprefs>
    <status>0</status>

    <stamp>
        <logo position="left" width="25%"/>
        <text size="50%">Date: <var name="date"/></text>
        <text size="50%">Record_id: <var name="record_id"/></text>';
        foreach ($coll->get_databox()->get_meta_structure() as $databox_field) {
            $name = $databox_field->get_name();
            $prefs .= '<text size="50%">' . $name . ': <field name="' . $name . '"/></text>' . "\n";
        }
        $prefs .= '</stamp>
    <caninscript>1</caninscript>
    <sugestedValues>
    </sugestedValues>
</baseprefs>';
        $newdom = new DOMDocument();
        $newdom->loadXML($prefs);
        $coll->set_prefs($newdom);
    }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:25,代码来源:imageTest.php

示例2: doResetRightsOnCollection

 /**
  * Resets admin rights on a collection.
  *
  * @param \ACL        $acl
  * @param \collection $collection
  */
 private function doResetRightsOnCollection(\ACL $acl, \collection $collection)
 {
     $baseId = $collection->get_base_id();
     $acl->set_limits($baseId, false);
     $acl->remove_quotas_on_base($baseId);
     $acl->set_masks_on_base($baseId, '0', '0', '0', '0');
     $acl->update_rights_to_base($baseId, ['canputinalbum' => '1', 'candwnldhd' => '1', 'candwnldsubdef' => '1', 'nowatermark' => '1', 'candwnldpreview' => '1', 'cancmd' => '1', 'canadmin' => '1', 'canreport' => '1', 'canpush' => '1', 'creationdate' => '1', 'canaddrecord' => '1', 'canmodifrecord' => '1', 'candeleterecord' => '1', 'chgstatus' => '1', 'imgtools' => '1', 'manage' => '1', 'modify_struct' => '1', 'bas_modify_struct' => '1']);
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:14,代码来源:ACLManipulator.php

示例3: isCollectionAvailable

 /**
  * Returns true if a collection is available given a configuration.
  *
  * @param \collection $collection
  *
  * @return Boolean
  */
 public function isCollectionAvailable(\collection $collection)
 {
     if (!$this->isRestricted()) {
         return true;
     }
     $availableCollections = $this->cache->fetch('available_collections_' . $collection->get_databox()->get_sbas_id()) ?: [];
     return in_array($collection->get_base_id(), $availableCollections, true);
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:15,代码来源:AccessRestriction.php

示例4: set_collection_order

 /**
  *
  * @param  collection $collection
  * @param  <type>     $ordre
  * @return appbox
  */
 public function set_collection_order(collection $collection, $ordre)
 {
     $sqlupd = "UPDATE bas SET ord = :ordre WHERE base_id = :base_id";
     $stmt = $this->get_connection()->prepare($sqlupd);
     $stmt->execute([':ordre' => $ordre, ':base_id' => $collection->get_base_id()]);
     $stmt->closeCursor();
     $collection->get_databox()->delete_data_from_cache(\databox::CACHE_COLLECTIONS);
     return $this;
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:15,代码来源:appbox.php

示例5: createEmptyCollectionJob

 /**
  * Creates a EmptyCollection task given a collection
  *
  * @param \collection $collection
  *
  * @return Task
  */
 public function createEmptyCollectionJob(\collection $collection)
 {
     $job = new EmptyCollectionJob($this->translator);
     $settings = simplexml_load_string($job->getEditor()->getDefaultSettings());
     $settings->bas_id = $collection->get_base_id();
     $task = new Task();
     $task->setName($job->getName())->setJobId($job->getJobId())->setSettings($settings->asXML())->setPeriod($job->getEditor()->getDefaultPeriod());
     $this->om->persist($task);
     $this->om->flush();
     $this->notify(NotifierInterface::MESSAGE_CREATE);
     return $task;
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:19,代码来源:TaskManipulator.php

示例6: plansDatatablesAjaxHandler

 public function plansDatatablesAjaxHandler(Request $request)
 {
     if ($request->input('method') == "first") {
         $objModelPlan = Plan::getInstance();
         $whereForPlans = array('rawQuery' => 'status = 1 or status = 0');
         $planLists = $objModelPlan->getAllPlansWhere($whereForPlans);
         $planLists = json_decode(json_encode($planLists), true);
         $plans = new collection();
         foreach ($planLists as $aap) {
             $id = $aap['plan_id'];
             $statusClass = $aap['status'] == 1 ? 'fa fa-check-circle' : 'fa fa-times-circle';
             $color = $aap['status'] == 1 ? 'green' : 'red';
             $text = $aap['status'] == 1 ? 'Active' : 'Inactive';
             $bgcolor = $aap['status'] == 1 ? 'lightgreen' : 'lightpink';
             $plans->push(['service' => $aap['plan_name'], 'min' => $aap['min_quantity'], 'max' => $aap['max_quantity'], 'ratepk' => $aap['charge_per_unit'], 'status' => '<div class="switch" id="status" data-id="' . $id . '" style="background-color:' . $color . '" >
             <input id=' . $id . ' class="cmn-toggle cmn-toggle-yes-no" type="checkbox" style="background-color:' . $color . '">
             <label for=' . $id . ' data-text="' . $text . '"></label>
         </div>', 'edit' => '<a href="/admin/plans-list-edit/' . $aap['plan_id'] . '" class="btn btn-sm btn-warning">Edit</a>']);
         }
         return Datatables::of($plans)->make(true);
     } else {
         if ($request->input('method') == "second") {
             $planType = $request->input('planType');
             $serviceType = $request->input('serviceType');
             $objModelPlans = Plan::getInstance();
             if ($planType == 5 && $serviceType == 5) {
                 $where = array('rawQuery' => 'status = 1 or status = 0');
             } elseif ($planType == 5 && $serviceType != 5) {
                 $where = array('rawQuery' => 'plan_type IN (0,1,3,4)  and service_type=?', 'bindParams' => [$serviceType]);
             } elseif ($planType != 5 && $serviceType == 5) {
                 $where = array('rawQuery' => 'service_type IN ("R","F","T") and plan_type =?', 'bindParams' => [$planType]);
             } else {
                 $where = array('rawQuery' => 'plan_type=? and service_type=?', 'bindParams' => [$planType, $serviceType]);
             }
             $planLists = $objModelPlans->getAllPlansWhere($where);
             $planLists = json_decode(json_encode($planLists), true);
             $plans = new collection();
             foreach ($planLists as $aap) {
                 $id = $aap['plan_id'];
                 $statusClass = $aap['status'] == 1 ? 'fa fa-check-circle' : 'fa fa-times-circle';
                 $color = $aap['status'] == 1 ? 'green' : 'red';
                 $bgcolor = $aap['status'] == 1 ? 'lightgreen' : 'lightpink';
                 $plans->push(['service' => $aap['plan_name'], 'min' => $aap['min_quantity'], 'max' => $aap['max_quantity'], 'ratepk' => $aap['charge_per_unit'], 'status' => '<a href="javascript:;" id="status" class="btn btn-sm btn-raised ' . $statusClass . '" style="color:' . $color . '; background-color:' . $bgcolor . '" data-id=' . $id . ' ></a>', 'edit' => '<a href="/admin/plans-list-edit/' . $aap['plan_id'] . '" class="btn btn-sm btn-warning">Edit</a>']);
             }
             return Datatables::of($plans)->make(true);
         }
     }
 }
开发者ID:sumitglobussoft,项目名称:INSTAGRAM-PANEL,代码行数:48,代码来源:PlansController.php

示例7: apply

 public function apply(Application $app, Request $request)
 {
     $records = RecordsRequest::fromRequest($app, $request, false, ['candeleterecord']);
     $datas = ['success' => false, 'message' => ''];
     try {
         if (null === $request->request->get('base_id')) {
             $datas['message'] = $app->trans('Missing target collection');
             return $app->json($datas);
         }
         if (!$app['acl']->get($app['authentication']->getUser())->has_right_on_base($request->request->get('base_id'), 'canaddrecord')) {
             $datas['message'] = $app->trans("You do not have the permission to move records to %collection%", ['%collection%', \phrasea::bas_labels($request->request->get('base_id'), $app)]);
             return $app->json($datas);
         }
         try {
             $collection = \collection::get_from_base_id($app, $request->request->get('base_id'));
         } catch (\Exception_Databox_CollectionNotFound $e) {
             $datas['message'] = $app->trans('Invalid target collection');
             return $app->json($datas);
         }
         foreach ($records as $record) {
             $record->move_to_collection($collection, $app['phraseanet.appbox']);
             if ($request->request->get("chg_coll_son") == "1") {
                 foreach ($record->get_children() as $child) {
                     if ($app['acl']->get($app['authentication']->getUser())->has_right_on_base($child->get_base_id(), 'candeleterecord')) {
                         $child->move_to_collection($collection, $app['phraseanet.appbox']);
                     }
                 }
             }
         }
         $ret = ['success' => true, 'message' => $app->trans('Records have been successfuly moved')];
     } catch (\Exception $e) {
         $ret = ['success' => false, 'message' => $app->trans('An error occured')];
     }
     return $app->json($ret);
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:35,代码来源:MoveCollection.php

示例8: includes

 /**
  * Itterate over object, build a relations, fillable and includes collection.
  *
  * @param model $object the model to iterate over
  *
  * @return array
  */
 private function includes($object)
 {
     $fillable = $object->getFillable();
     $includes = $object->getIncludes();
     $table = $object->getTable();
     $columns = $object->columns();
     $results[$table] = [];
     if (!empty($includes)) {
         foreach ($includes as $include) {
             $results[$table] = ['object' => $object, 'includes' => $this->includes(new $include())];
         }
     }
     $this->fillables->put($table, $fillable);
     $this->includes->push($table, $table);
     $this->columns->put($table, $columns);
     return $results;
 }
开发者ID:askedio,项目名称:laravel-cruddy,代码行数:24,代码来源:ApiObjects.php

示例9: getReference

 public function getReference()
 {
     $collection = collection::forClass($this->_className)->select();
     if (null != $this->_model) {
         $this->_model->save();
     }
     $id = $this->getId();
     return \MongoDBRef::create($collection->getName(), $id, (string) $collection->db);
 }
开发者ID:ExceptVL,项目名称:kanon-mongo,代码行数:9,代码来源:reference.php

示例10: append

 /**
 		@brief		Appends a new html string to the collection.
 		@since		2014-05-04 13:08:18
 	**/
 public function append($item)
 {
     $args = func_get_args();
     $text = @call_user_func_array('sprintf', $args);
     if ($text == '') {
         $text = $args[0];
     }
     return parent::append($text);
 }
开发者ID:Garth619,项目名称:wines-by-jennifer,代码行数:13,代码来源:html.php

示例11: list_collection

function list_collection($coll, $collection_list, $nav_bar)
{
    global $collection_list_tmpl;
    global $charset;
    $collection_list_tmpl = str_replace("!!cle!!", $coll, $collection_list_tmpl);
    $collection_list_tmpl = str_replace("!!list!!", $collection_list, $collection_list_tmpl);
    $collection_list_tmpl = str_replace("!!nav_bar!!", $nav_bar, $collection_list_tmpl);
    collection::search_form();
    print pmb_bidi($collection_list_tmpl);
}
开发者ID:hogsim,项目名称:PMB,代码行数:10,代码来源:collections_list.inc.php

示例12: createDB

 private function createDB(Connection $dbConn = null, $template)
 {
     $template = new \SplFileInfo(__DIR__ . '/../../../conf.d/data_templates/' . $template . '-simple.xml');
     $databox = \databox::create($this->app, $dbConn, $template);
     $this->app['acl']->get($this->app['authentication']->getUser())->give_access_to_sbas([$databox->get_sbas_id()])->update_rights_to_sbas($databox->get_sbas_id(), ['bas_manage' => 1, 'bas_modify_struct' => 1, 'bas_modif_th' => 1, 'bas_chupub' => 1]);
     $collection = \collection::create($this->app, $databox, $this->app['phraseanet.appbox'], 'test', $this->app['authentication']->getUser());
     $this->app['acl']->get($this->app['authentication']->getUser())->give_access_to_base([$collection->get_base_id()]);
     $this->app['acl']->get($this->app['authentication']->getUser())->update_rights_to_base($collection->get_base_id(), ['canpush' => 1, 'cancmd' => 1, 'canputinalbum' => 1, 'candwnldhd' => 1, 'candwnldpreview' => 1, 'canadmin' => 1, 'actif' => 1, 'canreport' => 1, 'canaddrecord' => 1, 'canmodifrecord' => 1, 'candeleterecord' => 1, 'chgstatus' => 1, 'imgtools' => 1, 'manage' => 1, 'modify_struct' => 1, 'nowatermark' => 1]);
     foreach (['PhraseanetIndexer', 'Subdefs', 'WriteMetadata'] as $jobName) {
         $job = $this->app['task-manager.job-factory']->create($jobName);
         $this->app['manipulator.task']->create($job->getName(), $job->getJobId(), $job->getEditor()->getDefaultSettings($this->app['conf']), $job->getEditor()->getDefaultPeriod());
     }
 }
开发者ID:romainneutron,项目名称:Phraseanet,代码行数:13,代码来源:Installer.php

示例13: collectionLocal

 /**
  * Constructor
  * @param object $dilps as reference
  */
 function collectionLocal(&$dilps)
 {
     /**
      * for use of $db and $db_prefix in loadImgData
      */
     parent::collection($dilps);
     $sql = 'SELECT * FROM ' . $dilps->db_prefix . 'collection where host = "local" and active = 1';
     $result = $dilps->db->Execute($sql);
     while (!$result->EOF) {
         $this->addCollId($result->fields['collectionid']);
         $result->MoveNext();
     }
 }
开发者ID:BackupTheBerlios,项目名称:dilps,代码行数:17,代码来源:collectionLocal.class.php

示例14: doJob

 /**
  * {@inheritdoc}
  */
 protected function doJob(JobData $data)
 {
     $app = $data->getApplication();
     $task = $data->getTask();
     $settings = simplexml_load_string($task->getSettings());
     $baseId = (string) $settings->base_id;
     $collection = \collection::get_from_base_id($app, $baseId);
     $collection->empty_collection(200);
     if (0 === $collection->get_record_amount()) {
         $this->stop();
         $this->dispatcher->dispatch(JobEvents::FINISHED, new JobFinishedEvent($task));
     }
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:16,代码来源:EmptyCollectionJob.php

示例15: processData

 private function processData(Application $app, $row, $logsql)
 {
     $databox = $app['phraseanet.appbox']->get_databox($row['sbas_id']);
     $rec = $databox->get_record($row['record_id']);
     switch ($row['action']) {
         case 'UPDATE':
             // change collection ?
             if (array_key_exists('coll', $row)) {
                 $coll = \collection::get_from_coll_id($app, $databox, $row['coll']);
                 $rec->move_to_collection($coll, $app['phraseanet.appbox']);
                 $app['phraseanet.SE']->updateRecord($rec);
                 if ($logsql) {
                     $this->log('debug', sprintf("on sbas %s move rid %s to coll %s \n", $row['sbas_id'], $row['record_id'], $coll->get_coll_id()));
                 }
             }
             // change sb ?
             if (array_key_exists('sb', $row)) {
                 $status = str_split($rec->get_status());
                 foreach (str_split(strrev($row['sb'])) as $bit => $val) {
                     if ($val == '0' || $val == '1') {
                         $status[31 - $bit] = $val;
                     }
                 }
                 $rec->set_binary_status(implode('', $status));
                 $app['phraseanet.SE']->updateRecord($rec);
                 if ($logsql) {
                     $this->log('debug', sprintf("on sbas %s set rid %s status to %s \n", $row['sbas_id'], $row['record_id'], $status));
                 }
             }
             break;
         case 'DELETE':
             if ($row['deletechildren'] && $rec->is_grouping()) {
                 foreach ($rec->get_children() as $child) {
                     $child->delete();
                     $app['phraseanet.SE']->removeRecord($child);
                     if ($logsql) {
                         $this->log('debug', sprintf("on sbas %s delete (grp child) rid %s \n", $row['sbas_id'], $child->get_record_id()));
                     }
                 }
             }
             $rec->delete();
             $app['phraseanet.SE']->removeRecord($rec);
             if ($logsql) {
                 $this->log('debug', sprintf("on sbas %s delete rid %s \n", $row['sbas_id'], $rec->get_record_id()));
             }
             break;
     }
     return $this;
 }
开发者ID:romainneutron,项目名称:Phraseanet,代码行数:49,代码来源:RecordMoverJob.php


注:本文中的collection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。